Skip to content
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

dynamic import fails with bytecodePlugin #656

Open
4 tasks done
HQidea opened this issue Nov 5, 2024 · 2 comments
Open
4 tasks done

dynamic import fails with bytecodePlugin #656

HQidea opened this issue Nov 5, 2024 · 2 comments

Comments

@HQidea
Copy link

HQidea commented Nov 5, 2024

Describe the bug

The bytecodePlugin worked perfectly until I added dynamic import to the code. After building the app, the dynamically imported module doesn't function as expected because, in the build result, the dynamic module requires ./index.js. However with bytecodePlugin enabled, the index.js is replaced with the bytecode-loader entry, not the original content. As a result, the dynamic module requires an empty export.

Minimal reproducible example is here, and I have committed the out dir on purpose.

Electron-Vite Version

2.3.0

Electron Version

31.0.2

Vite Version

5.3.1

Validations

@alex8088
Copy link
Owner

alex8088 commented Nov 5, 2024

import module in ES syntax

@HQidea
Copy link
Author

HQidea commented Nov 5, 2024

import module in ES syntax↳

Yes, I do use import in my code, and the requires I described before are generated in the bundle files.

You can check the dynamic module here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants