dynamic import is not working when the imported library has been listed in externals. #15388
Unanswered
songshuzhong
asked this question in
Q&A
Replies: 1 comment
-
Please create reproducible test repo, thanks |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug report
What is the current behavior?
dynamic import is not working when the imported library has been listed in externals.
If the current behavior is a bug, please provide the steps to reproduce.
import(/*webpackChunkName: "js-export-excel", webpackPrefetch: true */ 'js-export-excel')
.then(res => {
const options = {
name: props.title || 'sheetjs',
datas: [{
sheetData,
sheetName: props.title || 'sheetjs',
sheetHeader: sheetLabel
}]
};
new res.default(options).saveExcel();
}).catch(e => {
proxy.$message.error(e.message);
console.error(e);
});
module.exports = {
externals: {
'js-export-excel': 'js-export-excel'
}
};
3.result
Promise.resolve(/*! import() /).then(webpack_require.t.bind(null, /! js-export-excel */ "js-export-excel", 7)).then(function (res) {
var options = {
name: props.title || 'sheetjs',
datas: [{
sheetData: sheetData,
sheetName: props.title || 'sheetjs',
sheetHeader: sheetLabel
}]
};
new res.default(options).saveExcel();
}).catch(function (e) {
proxy.$message.error(e.message);
console.error(e);
});
What is the expected behavior?
Other relevant information:
webpack version: 4.44.2
Node.js version: 14.18.1
Operating System: mac
Additional tools:
Beta Was this translation helpful? Give feedback.
All reactions