question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to fetch dynamically imported module: http://127.0.0.1:8081/node_modules/@ui5/webcomponents/dist/Button.js

See original GitHub issue

Describe the bug I want to create a custom element extending lit-element. Within this element I want to use <ui5-button/>. Unfortunately my initial import for the button fails:

import('@ui5/webcomponents/dist/Button');

Log output / Any errors in the console

Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://127.0.0.1:8081/node_modules/@ui5/webcomponents/dist/Button.js

Failed to load module script: The server responded with a non-JavaScript MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

Root cause seem to be the import calls for json files in Button.js, e.g. import belize from './themes/sap_belize/Button.json';

To reproduce

import { LitElement, html } from 'lit-element';
import('@ui5/webcomponents/dist/Button');
export class MyElement extends LitElement {
  render() {
    return html`
      <ui5-button>Hello world!</ui5-button>
    `;
  }
}
customElements.define('my-element', MyElement);

Expected behavior import call should just work as expected

Context

  • UI5 Web Components version: 0.7.0
  • Browser: Chrome 72.0.3626.109
  • Other information: polymer-cli 1.9.6, lit-element 2.0.1

Affected components all

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pskelincommented, Mar 3, 2019

@pwasem the latest release on npm (0.8.0) should now work for your setup (datepicker, panel and text area will be addressed in a future release, but the rest should be fine now).

Could you give it a try and let me know if there are any problems?

1reaction
pskelincommented, Feb 27, 2019

@pwasem: you have a valid point, thanks for bringing it through.

I did a bit more reasearch and I think we can achieve for most components to be JS-only imports without an additional configuration, so I’ll post an update here soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error loading preloads: Failed to fetch dynamically imported ...
I installed Jupyter using Anaconda for my current environment, opened it once, and then I was able to use that environment in VS...
Read more >
Failed to fetch dynamically imported module #1144 - GitHub
This error happens when you have an error in your code which is causing a module import to fail. I would suggest that...
Read more >
Failed to fetch dynamically imported module | Blazor Forums
If we are using services.AddSyncfusionBlazor(true) and get css file and javascript from CDN, we don't see the error on console but the ...
Read more >
vite typeerror: failed to fetch dynamically imported module
I successfuly import the module in a equivalent Vue.js application. In the vite.config.js file of my utility module, i'm declaring my module @hexagone/ ......
Read more >
VS2022 RC2 Brand new Blazor project doesn't run
TypeError: Failed to fetch dynamically imported module: https://localhost:44318/_framework/blazor-hotreload.js) —> Microsoft.JSInterop.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found