2017-01-28 24 views

回答

0

把它放在你的WebPack配置..大多來自基

var path = require("path") 
var webpack = require('webpack') 

module.exports = { 
    context: __dirname, 

    entry: { 
    // Add as many entry points as you have container-react-components here 
    App: './reactjs/App', 
    vendors: ['react'], 
    }, 

    output: { 
     path: path.resolve('./example/static/bundles/local/'), 
     filename: "[name]-[hash].js" 
    }, 

    externals: [ 
    ], // add all vendor libs 

    plugins: [ 
    new webpack.optimize.CommonsChunkPlugin({ name: 'vendors', filename: 'vendors.bundle.js', minChunks: Infinity }), 
    ], // add all common plugins here 

    module: { 
    loaders: [] // add all common loaders here 
    }, 

    resolve: { 
     alias: { 
     react: path.resolve('./node_modules/react'), 
    lodash: path.resolve('./node_modules/lodash') 
    } 
}, 
} 

乾杯....