Webpack 找不到 webpack.config.js
Webpack can't find webpack.config.js
当我尝试 运行 npm 脚本时,Webpack 2.2.0 给了我这个错误:
No configuration file found and no output filename configured via CLI option.
我确定 webpack.config.js 在 src 文件夹中。
module.exports = {
entry: './src/app.js',
output: {
filename: './dist/app.bundle.js'
}
}
Here is my project structure.
感谢任何帮助。
您有 2 个解决方案:
- 将
webpack.config.js
移动到根文件夹而不是 ./src
(Jared Farrish 指出)
- 在指向
./src/webpack.config.js
的 CLI 中使用 --config
属性:webpack --config src/webpack.config.js
当我尝试 运行 npm 脚本时,Webpack 2.2.0 给了我这个错误:
No configuration file found and no output filename configured via CLI option.
我确定 webpack.config.js 在 src 文件夹中。
module.exports = {
entry: './src/app.js',
output: {
filename: './dist/app.bundle.js'
}
}
Here is my project structure.
感谢任何帮助。
您有 2 个解决方案:
- 将
webpack.config.js
移动到根文件夹而不是./src
(Jared Farrish 指出) - 在指向
./src/webpack.config.js
的 CLI 中使用--config
属性:webpack --config src/webpack.config.js