I think you can achieve this using DllPlugin and DllReferencePlugin
DllPlugin webpack dll . manifest.json, DllReferencePlugin .
https://webpack.js.org/plugins/dll-plugin/
, (React, Flux ..) , Webpack, React .., React , DllReferencePlugin.
webpack.dll.js:
var path = require("path");
var webpack = require("webpack");
module.exports = {
entry: {
libs: [path.join(__dirname, "common", "lib.js")]
},
output: {
path: path.join(__dirname, "dist", "dll"),
filename: "[name].dll.js",
library: "[name]"
},
plugins: [
new webpack.DllPlugin({
path: path.join(__dirname, "dll", "[name]-manifest.json"),
name: "[name]",
context: path.resolve(__dirname, "common")
}),
]
};
webpack.config.js .
new webpack.DllReferencePlugin({
context: path.resolve(__dirname, "common"),
manifest:require('./dll/libs-manifest.json')
})
, , Dll, webpack . dll -.