webpackIgnore prevents polyfilling of dynamic import
See original GitHub issueBug report
What is the current behavior?
import( /* webpackIgnore: true */ 'https://external.site/script.js')
should not be interpreted by webpack (which works), but it also does not get transpiled correctly using babel-loader.
If the current behavior is a bug, please provide the steps to reproduce.
https://github.com/beckerei/webpack-babel-dynamic-import
There is noch much needed besides webpack, babel-loader and a correct browserlist (so that import should get polyfilled)
It seems that the line containing webpackIgnore is not run through the loaders as well.
It’s kind of hard to find out what exactly webpackIgnore does, it is only ever found in context with import. What does it actually do?
You can find the output from webpack under https://github.com/beckerei/webpack-babel-dynamic-import/blob/master/dist/main.js it still contains import()
What is the expected behavior?
Babels preset-env can polyfill import now by default, but adding the import polfyfill plugin does not change the webpack output.
Other relevant information: webpack version: 4.41.6 Node.js version: 13.8.0 Operating System: OSX Additional tools: babel-loader@8.0.6, @babel/preset-env@7.8.4
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (3 by maintainers)

Top Related StackOverflow Question
I’ll close this now. Seems only fair as it’s not an webpack issue, it should not count towards the open issue count 👍
I’m not sure you can import react components with the method I described above. We don’t import a component just a 3rd party script, which has nothing to do with react.
You might be interested in webpacks module federation plugin, read about it https://itnext.io/webpack-5-module-federation-a-game-changer-to-javascript-architecture-bcdd30e02669
As I’m unfamiliar with how exactly systemjs works you might want to give this a try.