Webpack:找不到bundle.js
我终于得到了他的开发服务器运行,我在屏幕上得到的东西。 我已经为NPM设置了一个“启动”脚本,如下所示:
"start": "webpack-dev-server --content-base app"
我收到一个错误:
http://localhost:8080/bundle.js Failed to load resource: the server responded with a status of 404 (Not Found)
我的文件夹设置如下:
appDir ->app ->node_modules webpack.config.js package.json
我的webpack.config.js:
module.exports = { context: __dirname + '/app', entry: './index.js', output: { path: __dirname + '/app', filename: './bundle.js' } }
你能告诉什么是错的吗?
bundle.js位于你的/app
目录中。 输出中的该path
选项指定文件的绝对path。
你也不需要./
的文件名。 它将相对于output.path
得到解决,但是令人困惑并且可能导致了您的问题。