Module not found: Error: Empty dependency (no request)
PS F:\vue\vue20200414\param14> npm run dev> param8@1.0.0 dev F:\vue\vue20200414\param14> webpack --config ./webpack.dev.config.jsWebpack is watching the files…Hash: 746697a4744ddb05d...
·
PS F:\vue\vue20200414\param14> npm run dev
> param8@1.0.0 dev F:\vue\vue20200414\param14
> webpack --config ./webpack.dev.config.js
Webpack is watching the files…
Hash: 746697a4744ddb05dc79
Version: webpack 3.12.0
Time: 371ms
Asset Size Chunks Chunk Names
0.js 133 bytes 0 [emitted]
1.js 132 bytes 1 [emitted]
util.js 146 bytes 2 [emitted] util
main.js 903 bytes 3 [emitted] main
common.js 233 kB 4 [emitted] common
index.html 390 bytes [emitted]
[0] (webpack)/buildin/global.js 509 bytes {4} [built]
[3] ./src/main.js 428 bytes {3} [built]
[6] multi vue 28 bytes {2} [built]
[7] ./src/A.js 52 bytes {1} [built]
[8] ./src/B.js 53 bytes {0} [built]
+ 4 hidden modules
ERROR in ./src/main.js
Module not found: Error: Empty dependency (no request)
@ ./src/main.js 6:4-9:6
Child html-webpack-plugin for "index.html":
1 asset
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html 450 bytes {0} [built]
[2] (webpack)/buildin/global.js 509 bytes {0} [built]
[3] (webpack)/buildin/module.js 517 bytes {0} [built]
+ 1 hidden module
原因及其解决方法:
解决步骤如下:将[]中的分号去掉,require.ensure(['']...,./A.js没有依赖了,不需要写
提示main.js有错误,module没有发现空依赖
main.js代码如下
import Vue from 'vue';
document.getElementById('abtn').onclick = function () {
require.ensure([''],function () {
var A = require('./A')
console.log(A.data);
})
// 异步的加载A.js
}
document.getElementById('bbtn').onclick = function () {
require.ensure([],function () {
var B = require('./B')
console.log(B.data);
})
// 异步的加载A.js
}
更多推荐
已为社区贡献8条内容
所有评论(0)