【发布时间】:2019-10-31 20:20:14
【问题描述】:
当我尝试使用此代码动态导入 vue 组件时:
const components = require.context('./', true, '/^index\.js$/');
我收到此错误:
app.js:9 Uncaught TypeError: __webpack_require__(...).context is not a function
at Module../asset/app.js (app.js:9)
at __webpack_require__ (bootstrap:782)
at fn (bootstrap:150)
at Object.0 (app.293d5fe1d8a073fed37a.bundle.js:1747)
at __webpack_require__ (bootstrap:782)
at checkDeferredModules (bootstrap:45)
at bootstrap:858
at bootstrap:858
这是为什么呢?如何解决?我错过了什么?
【问题讨论】: