我最近接着使用了Webpack,因为我不太了解它,我需要它来做出反应并且redux能够正常工作。 我成功运行webpack但是我找不到捆绑包。 我尝试使用CommonsChunkPlugin()但没有任何反应。
这是webpack.config.js:
let path = require('path');
let webpack = require('webpack');
module.exports = {
entry: {
main: "./public/brain/main.brain.js",
index:"./public/brain/index.brain.js",
login: "./public/brain/login.brain.js",
register:"./public/brain/register.brain.js"
},
output: {
path: path.resolve(__dirname,"js"),
filename: "[name].nerve.js"
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: "bundle",
chunks: ["main","index", "login","register"]
}),
new webpack.optimize.CommonsChunkPlugin({
name: "nerve-users",
chunks: ["login", "register"]
}),
new webpack.optimize.CommonsChunkPlugin({
name: "nerve-index",
chunks: ["index"]
}),
],
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react' ,'env']
},
exclude: /node_modules/
}
]
},
stats: {
colors: true
},
devtool: 'source-map',
};