无法找到bundle.js文件。 得到404错误,浏览器上找不到/dist/bundle.js。但是有dist目录存在,我可以在里面看到bundle.js文件。可能是问题,给出的是我的webpack.config.js文件。
const path = require("path");
const webpack = require("webpack");
const bundlePath = path.resolve(__dirname, "/dist/");
module.exports = {
entry: "./src/index.js",
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
options: { presets: ['env'] }
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
]
},
resolve: { extensions: ['*', '.js', '.jsx'] },
output: {
publicPath: bundlePath,
filename: "bundle.js"
},
devServer: {
contentBase: path.join(__dirname,'public'),
port: 3000
},
plugins: [ new webpack.HotModuleReplacementPlugin() ]
};