How to get dynamic imports to work in webpack 4

后端 未结 1 1378
迷失自我
迷失自我 2021-01-05 17:57

I\'m trying to migrate my app to webpack 4. My head hurts already.

Dynamic imports - this is my method of code splitting (page by page). But I can\

相关标签:
1条回答
  • 2021-01-05 18:39

    I was facing the same issue the fix was:

    npm install --save-dev @babel/plugin-syntax-dynamic-import
    

    add following line to .babelrc

    "plugins": ["@babel/plugin-syntax-dynamic-import"],
    

    Sources:

    • https://webpack.js.org/guides/code-splitting/#dynamic-imports

    • https://babeljs.io/docs/plugins/syntax-dynamic-import/#installation

    0 讨论(0)
提交回复
热议问题