Introduce DllPlugin
parent
5eff3ef204
commit
1f9f93460b
|
@ -1,10 +1,16 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
<head>
|
||||||
<title>Chronograf</title>
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||||
</head>
|
<title>Chronograf</title>
|
||||||
<body>
|
</head>
|
||||||
<div id='react-root' data-basepath=""></div>
|
|
||||||
</body>
|
<body>
|
||||||
|
<div id='react-root' data-basepath=""></div>
|
||||||
|
<script type="text/javascript" src="/vendor/vendor.dll.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -39,7 +39,6 @@ module.exports = {
|
||||||
devtool: 'inline-eval-cheap-source-map',
|
devtool: 'inline-eval-cheap-source-map',
|
||||||
entry: {
|
entry: {
|
||||||
app: path.resolve(__dirname, '..', 'src', 'index.js'),
|
app: path.resolve(__dirname, '..', 'src', 'index.js'),
|
||||||
vendor: Object.keys(dependencies),
|
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
publicPath: '/',
|
publicPath: '/',
|
||||||
|
@ -132,6 +131,10 @@ module.exports = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new webpack.DllReferencePlugin({
|
||||||
|
context: process.cwd(),
|
||||||
|
manifest: require('../build/vendor/vendor.dll.json'),
|
||||||
|
}),
|
||||||
new ForkTsCheckerWebpackPlugin({
|
new ForkTsCheckerWebpackPlugin({
|
||||||
checkSyntacticErrors: true,
|
checkSyntacticErrors: true,
|
||||||
}),
|
}),
|
||||||
|
@ -158,9 +161,6 @@ module.exports = {
|
||||||
inject: 'body',
|
inject: 'body',
|
||||||
favicon: 'assets/images/favicon.ico',
|
favicon: 'assets/images/favicon.ico',
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
names: ['vendor', 'manifest'],
|
|
||||||
}),
|
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
VERSION: JSON.stringify(require('../package.json').version),
|
VERSION: JSON.stringify(require('../package.json').version),
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
const path = require('path')
|
||||||
|
const webpack = require('webpack')
|
||||||
|
const packages = require('../package.json')
|
||||||
|
const dependencies = packages.dependencies
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
node: {
|
||||||
|
fs: 'empty',
|
||||||
|
module: 'empty',
|
||||||
|
},
|
||||||
|
context: process.cwd(),
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.json'],
|
||||||
|
modules: [__dirname, 'node_modules'],
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
vendor: Object.keys(dependencies),
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].dll.js',
|
||||||
|
path: path.resolve(__dirname, '../build/vendor'),
|
||||||
|
library: '[name]',
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DllPlugin({
|
||||||
|
name: '[name]',
|
||||||
|
path: './build/vendor/[name].dll.json',
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue