关于vue,使用webpack --mode=development命令时报错Failed to load ‘......webpack.config.js‘ config的问题
报错Module not found: Error: Can't resolve 'D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js' in 'D:\workSpace备份\vs\yygh\webpackdemo\src'resolve 'D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js' in
·
报错
Module not found: Error: Can't resolve 'D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js' in 'D:\workSpace备份\vs\yygh\webpackdemo\src'
resolve 'D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js' in 'D:\workSpace备份\vs\yygh\webpackdemo\src'
No description file found in D:\workSpace备份\vs\yygh\webpackdemo\src or above
No description file found in D:\workSpace备份\vs\yygh\webpackdemo\src\src or above
D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js doesn't exist
.js
D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js.js doesn't exist
.json
D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js.json doesn't exist
.wasm
D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js.wasm doesn't exist
as directory
D:\workSpace备份\vs\yygh\webpackdemo\src\src\main.js doesn't exist
webpack 5.59.1 compiled with 1 error in 57 ms
解决
由
constpath=require("path") //Node.js内置模块
module.exports= {
entry: './src/main.js', //配置入口文件
output: {
path: path.resolve(__dirname, './dist'), //输出路径,__dirname:当前文件所在路径
filename: 'bundle.js'//输出文件
}
}
改成
const path = require('path')
module.exports = {
entry: path.join(__dirname, 'src/main.js'),
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'dist')
}
}
更多推荐
已为社区贡献1条内容
所有评论(0)