Webpack ..如何找到或要求bundle.js文件

时间:2017-05-10 16:11:35

标签: reactjs webpack react-router react-redux webpack-dev-server

我最近接着使用了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',
};

Cmd:

0 个答案:

没有答案