-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundling error "Failed to fetch dynamically imported module" when adding a package made with Stencil.js #12434
Comments
Start a new pull request in StackBlitz Codeflow. |
Duplicate of #3326 |
The bundle includes this part of the code. It seems stencil requires the library to be compiled with A workaround is to set @patak-dev Is it possible to detect whether the file will exist after the dep-optimizer finished? vite/packages/vite/src/node/plugins/optimizedDeps.ts Lines 71 to 74 in e23f690
We currently throw 504 here but in this case, reload won't happen because it's not a outdated non-entry point. |
Changing this in the |
wow that worked for me too! man this really needs to be documented, so many unanswered questions online when trying to research this... exclude: [
'@ionic/core/loader' //fix weird Vite error "outdated optimize dep"
], |
after more than 3 hours debbuging i found this issue and worked for me, thanks |
Hello folks, in my case i added a private package from google cloud artifact, the package its already installed in node_modules/@quickstart/footer-component, i'm using
but when i deploy on render doest'n work even if i tried to import in both ways i get the same error
what i need to change on my vite.config.ts to solve this? |
I had this same issue right after just install Material UI. i had to delete node_module folder and reinstall every package with npm install before the error got cleared |
Great! It's working now! Thanks for your help. I'm using |
This fixed it in development, thanks a lot! However, when I generate a production build, the error comes back. Reproduction: https://stackblitz.com/edit/vitejs-vite-3wnebs?file=package.json,index.html To reproduce:
The custom element is not rendered, and there are errors on the console. I've spent hours tinkering with |
the fore-mentioned workaround definitely worked for me on vite. My package was react-three library, i added in exclude array, then deleted node_modules, run npm i thanks |
Had a very similar error today, but all that was required was deleting the |
Thank you @heloineto, this started happening in my Ionic app build (yarn dev) quite frequently, and I had to keep reinstalling all node_modules. The vite config definitely fixed it:
|
the folder |
I also had an issue with |
|
Same here. Also tried enableImportInjection: true unsuccessfully :_( |
It finally worked, we had to rename enableImportInjection to experimentalImportInjection. The stencil compiler indicated
The fix that finally worked and enabled us to import stencil components into a built vue application was: Stencil.config.js
Using:
|
Building Stencil with the |
extras: {
enableImportInjection: true
} AND optimizeDeps: {
exclude: ['myStencilLib/loader']
} worked for me |
Good to hear! I'm not able to custom recompile Stencil though, is there a way to add this to vite.config? |
Is there a known solution that involves neither giving up on certain optimizations nor customizing (patching, rebuilding, etc.) other packages to make them not trigger the issue? |
I was also getting the same issue like i.e. How fix it... in vite.congfig.ts I added export default defineConfig({ and restarted the app. |
This worked for me in storybook-static 🙏 Before my components worked in storybook dev environment but didn’t work in storybook-static. |
I'll close this issue as it's something that the library needs to work on.
About having a better message, let's track that in #13506. |
Hello how did you solve this error can u plz help! thanks. |
Describe the bug
When adding the blip-ds package to a Vite project, the following errors are shown in the console:
The package is a web components library made using Stencil.js. It works normally with webpack.
I believe this is a bundling error related to import handling.
Reproduction
https://stackblitz.com/edit/vitejs-vite-e6u1bw?file=index.html
Steps to reproduce
npm i blip-ds
<bds-input />
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: