Introduce DllPlugin
parent
7802189804
commit
a9d3ef04c1
|
@ -1,10 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
<title>Chronograf</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id='react-root' data-basepath=""></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Chronograf</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='react-root' data-basepath=""></div>
|
||||
<script type="text/javascript" src="/vendor/vendor.dll.js"></script>
|
||||
</body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -39,7 +39,6 @@ module.exports = {
|
|||
devtool: 'inline-eval-cheap-source-map',
|
||||
entry: {
|
||||
app: path.resolve(__dirname, '..', 'src', 'index.js'),
|
||||
vendor: Object.keys(dependencies),
|
||||
},
|
||||
output: {
|
||||
publicPath: '/',
|
||||
|
@ -132,6 +131,10 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: process.cwd(),
|
||||
manifest: require('../build/vendor/vendor.dll.json'),
|
||||
}),
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
checkSyntacticErrors: true,
|
||||
}),
|
||||
|
@ -158,9 +161,6 @@ module.exports = {
|
|||
inject: 'body',
|
||||
favicon: 'assets/images/favicon.ico',
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
names: ['vendor', 'manifest'],
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
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