-
|
Hi all. I'm trying to convert from Babel to SWC, but Webpack stopped generating chunks for dynamic imports in my server build. My best guess is that this is because of the difference in output between @loadable/babel-plugin and @swc/plugin-loadable-components. When using @babel/loadable-plugin, the output was importAsync: () => Promise.resolve().then(() =>
_interopRequireWildcard(require(/* webpackChunkName: "components-JobRunningAnalysisAnimation-JobRunningAnalysisAnimation" */"./components/JobRunningAnalysisAnimation/JobRunningAnalysisAnimation"))).then(m => m.JobRunningAnalysisAnimation),But when using @swc/plugin-loadable-components, the output is importAsync: ()=>import("./components/JobRunningAnalysisAnimation/JobRunningAnalysisAnimation")
.then((m)=>m.JobRunningAnalysisAnimation),or if I set the importAsync: ()=>Promise.resolve().then(()=>/*#__PURE__*/
_interop_require_wildcard(require("./components/JobRunningAnalysisAnimation/JobRunningAnalysisAnimation"))).then((m)=>m.JobRunningAnalysisAnimation),It's weird because I see the webpackChunkName comment was generated in #300. Is there a way to generate that PS: I see the magic comments being generated in the test files, like https://github.com/swc-project/plugins/blob/main/packages/loadable-components/tests/fixture/simple%20import/should%20transform%20path%20into%20chunk-friendly%20name/. But when I try the same thing locally, it doesn't get the magic comment: import loadable from "@loadable/component";
loadable(() => import("../foo/bar")); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Ah, I figured it out. I was trying to turn off minification, but inadvertently enabled it: The second |
Beta Was this translation helpful? Give feedback.
Ah, I figured it out. I was trying to turn off minification, but inadvertently enabled it:
The second
minifysection was actually stripping those magic comments.