This repository has been archived by the owner on Jun 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Unable to use import() with magic comments #34
Comments
This might be a duplicate of #25 |
Same for me, I'm receiving the |
const setEditorUi = function () {
const WidgetsService = require('live/services/widgets')
import(/* webpackChunkName: "editor" */ './ui/default').then(m => WidgetsService.editor('default', m))
import(/* webpackChunkName: "editor" */ './ui/html').then(m => WidgetsService.editor('html', m))
} Gets transformed into: var setEditorUi = function setEditorUi() {
var WidgetsService = __webpack_require__(/*! live/services/widgets */ "./js/live-core/services/widgets.js");
new Promise(function (resolve) {
__webpack_require__.e(/*! require.ensure */ 1).then((function (require) {
resolve(__webpack_require__( /* webpackChunkName: "editor" *//*! ./ui/default */ "./js/modules/widget/ui/default/index.js"));
}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
}).then(function (m) {
return WidgetsService.editor('default', m);
});
new Promise(function (resolve) {
Promise.all(/*! require.ensure */[__webpack_require__.e("vendor"), __webpack_require__.e(2)]).then((function (require) {
resolve(__webpack_require__( /* webpackChunkName: "editor" *//*! ./ui/html */ "./js/modules/widget/ui/html/index.js"));
}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
}).then(function (m) {
return WidgetsService.editor('html', m);
});
}; |
Make sure you set:
If you are using typescript, also make sure:
This works for me and here is my commit for adding dynamic import (code split) support to my react-typescript project, hope it helps :) |
For TypeScript user, make sure tsconfig.json:
|
Thank you!! it was the |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
import(/* webpackChunkName: "plugin" */ './plugin.js')
sets chunk[name]
the same as[id]
, so the output filename is0.0.js
(in config:chunkFilename: '[id].[name].js'
)The text was updated successfully, but these errors were encountered: