From a9d3ef04c104457a1c807e3439f750db4e2e1146 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Sat, 24 Feb 2018 11:31:39 -0700 Subject: [PATCH] Introduce DllPlugin --- ui/src/index.template.html | 22 ++++++++++++++-------- ui/webpack/devConfig.js | 8 ++++---- ui/webpack/vendor.config.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 ui/webpack/vendor.config.js diff --git a/ui/src/index.template.html b/ui/src/index.template.html index b5d4cc1f6b..e363c97388 100644 --- a/ui/src/index.template.html +++ b/ui/src/index.template.html @@ -1,10 +1,16 @@ - - - Chronograf - - -
- - + + + + Chronograf + + + +
+ + + + + + \ No newline at end of file diff --git a/ui/webpack/devConfig.js b/ui/webpack/devConfig.js index ef944cd58a..95a55dd0d2 100644 --- a/ui/webpack/devConfig.js +++ b/ui/webpack/devConfig.js @@ -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), }), diff --git a/ui/webpack/vendor.config.js b/ui/webpack/vendor.config.js new file mode 100644 index 0000000000..ef78496cc5 --- /dev/null +++ b/ui/webpack/vendor.config.js @@ -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', + }), + ], +}