在某些情况下,我不想使用webpack转换来动态导入webpack 4。
我们可以使用某些选项吗?
async componentDidMount() {
const { default: Greeting } = await import("/components/Greeting.js");
this.setState({ component: Greeting });
}
此/components/Greeting.js
已在服务器上预编译。在Chrome浏览器中,如果没有webpack,它就无法正常工作。
webpack正在尝试编译并发出错误
Uncaught (in promise) Error: Cannot find module '/components/Greeting.js'
at webpackMissingModule
答案 0 :(得分:5)