Failed to fetch dynamically imported module: http://127.0.0.1:8081/node_modules/@ui5/webcomponents/dist/Button.js
See original GitHub issueDescribe 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:
- Created 5 years ago
- Comments:12 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@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?
@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.