このWebpack2は、私ははっきりとここ3回の反応梱包していますCommonsChunkPlugin
[01] [00] WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (250 kB). This can impact web performance.
[01] [00] Entrypoints:
[01] [00] app (5.43 MB)
[01] [00] vendor1.bundle.js
[01] [00] vendor1.bundle.js.map
[01] [00] app.bundle.js
[01] [00] styles.css
[01] [00] app.bundle.js.map
[01] [00] styles.css.map
[01] [00]
[01] [00] vendor2 (2.37 MB)
[01] [00] vendor1.bundle.js
[01] [00] vendor1.bundle.js.map
[01] [00] vendor2.bundle.js
[01] [00] vendor2.bundle.js.map
[01] [00]
[01] [00] vendor1 (901 kB)
[01] [00] vendor1.bundle.js
[01] [00] vendor1.bundle.js.map
このWebPACKの構成
let plugins =() => {
let basePLUGINS = [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor1','vendor2'],
minChunks: Infinity
}),
new HtmlWebpackPlugin({
chunks: ['app'],
body: true,
chunksSortMode: 'dependency',
env: {
Prod: args.options.prod
},
template: 'src/index.ejs'
}),
new webpack.LoaderOptionsPlugin({
options: {
sassLoader: {
includePaths: [path.resolve(__dirname, "./src/sass")]
},
context: '/',
postcss: [
require("postcss-cssnext")(
{
browsers: '> 0%',
customProperties: true,
colorFunction: true,
customSelectors: true,
})
]
}
}),
];
if (args.options.prod) {
basePLUGINS.push(
new ExtractTextPlugin({
filename: "styles.css",
disable: false,
allChunks: true,
sourceMapFilename: '[file].map'
}),
new webpack.optimize.UglifyJsPlugin({
compress: {warnings: false},
output: {comments: false},
sourceMap: true
})
);
return basePLUGINS
}
return basePLUGINS
};
module.exports = {
entry: {
app: "./src/ts/app.tsx",
vendor2: ['react-dom'],
vendor1: ['react']
},
plugins: plugins(),
output: {
filename: "[name].bundle.js",
path: path.join(__dirname, "www")
},
を考慮した複数のバンドルから重複したコードを削除しますか? CommonsChunkPluginはここで助けが必要です 私はベンダー2を作ることができますし、私のアプリケーションは自分のコードベースを変更せずに反応を含んでいませんか? ランニングがwebpack2.beta28
webpack2が道 –
私の完全なプラグイン機能が無関係であることによって、同じ結果を生成し
は私が持っているだろうが、私は編集しています:
は、そこで質問エントリポイントを考慮します質問 – CESCO