-
Notifications
You must be signed in to change notification settings - Fork 96
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
Runtime externals don't work in webpack #238
Comments
Could you provide a duplicate? |
Here is a reproduction: https://github.com/ef4/unplugin-bug-repro It contains both rollup and webpack configs, so you can see that the rollup build works correctly and the webpack build fails at runtime. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
unplugin 1.0.1
Reproduction
https://github.com/ef4/unplugin-bug-repro (edited to add)
Describe the bug
This code:
unplugin/src/webpack/index.ts
Lines 126 to 128 in c29ef3e
tries to locate external modules on the filesystem at build time, and if they're not found it introduces empty virtual modules for them.
But this means we cannot actually use
externals
the way that both webpack and rollup typically understandexternals
: they're supposed to get resolved at runtime. Whether they existed during build time is not supposed to matter.Expected behavior:
resolveId
hook returnsfalse
, the original import statement should be left alone in the output, so that it will be resolved at runtime.resolveId
hook returns{ external: true, id: 'xyz' }
, the original import statement gets replaced with an import statement for'xyz'
, and that redirected import statement will get resolved at runtime.Actual behavior:
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: