Client: add dll support
This commit is contained in:
parent
be3bac3afb
commit
cc3e2d9b7a
4 changed files with 55 additions and 2 deletions
1
client/.gitignore
vendored
1
client/.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
/node_modules
|
/node_modules
|
||||||
/compiled
|
/compiled
|
||||||
/stats.json
|
/stats.json
|
||||||
|
/dll
|
||||||
|
|
|
@ -323,7 +323,7 @@ module.exports = function (options) {
|
||||||
* See: https://webpack.github.io/docs/configuration.html#node
|
* See: https://webpack.github.io/docs/configuration.html#node
|
||||||
*/
|
*/
|
||||||
node: {
|
node: {
|
||||||
global: 'true',
|
global: true,
|
||||||
crypto: 'empty',
|
crypto: 'empty',
|
||||||
process: true,
|
process: true,
|
||||||
module: false,
|
module: false,
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
const helpers = require('./helpers')
|
const helpers = require('./helpers')
|
||||||
const webpackMerge = require('webpack-merge') // used to merge webpack configs
|
const webpackMerge = require('webpack-merge') // used to merge webpack configs
|
||||||
|
const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'})
|
||||||
const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev
|
const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Webpack Plugins
|
* Webpack Plugins
|
||||||
*/
|
*/
|
||||||
|
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
|
||||||
const DefinePlugin = require('webpack/lib/DefinePlugin')
|
const DefinePlugin = require('webpack/lib/DefinePlugin')
|
||||||
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
|
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
|
||||||
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
|
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
|
||||||
|
@ -23,6 +25,8 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
|
||||||
HMR: HMR
|
HMR: HMR
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Webpack configuration
|
* Webpack configuration
|
||||||
*
|
*
|
||||||
|
@ -106,6 +110,52 @@ module.exports = function (env) {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
new DllBundlesPlugin({
|
||||||
|
bundles: {
|
||||||
|
polyfills: [
|
||||||
|
'core-js',
|
||||||
|
{
|
||||||
|
name: 'zone.js',
|
||||||
|
path: 'zone.js/dist/zone.js'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'zone.js',
|
||||||
|
path: 'zone.js/dist/long-stack-trace-zone.js'
|
||||||
|
},
|
||||||
|
'ts-helpers'
|
||||||
|
],
|
||||||
|
vendor: [
|
||||||
|
'@angular/platform-browser',
|
||||||
|
'@angular/platform-browser-dynamic',
|
||||||
|
'@angular/core',
|
||||||
|
'@angular/common',
|
||||||
|
'@angular/forms',
|
||||||
|
'@angular/http',
|
||||||
|
'@angular/router',
|
||||||
|
'@angularclass/hmr',
|
||||||
|
'rxjs'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
dllDir: helpers.root('dll'),
|
||||||
|
webpackConfig: webpackMergeDll(commonConfig({env: ENV}), {
|
||||||
|
devtool: 'cheap-module-source-map',
|
||||||
|
plugins: []
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plugin: AddAssetHtmlPlugin
|
||||||
|
* Description: Adds the given JS or CSS file to the files
|
||||||
|
* Webpack knows about, and put it into the list of assets
|
||||||
|
* html-webpack-plugin injects into the generated html.
|
||||||
|
*
|
||||||
|
* See: https://github.com/SimenB/add-asset-html-webpack-plugin
|
||||||
|
*/
|
||||||
|
new AddAssetHtmlPlugin([
|
||||||
|
{ filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('polyfills')}`) },
|
||||||
|
{ filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('vendor')}`) }
|
||||||
|
]),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin: NamedModulesPlugin (experimental)
|
* Plugin: NamedModulesPlugin (experimental)
|
||||||
* Description: Uses file names as module name.
|
* Description: Uses file names as module name.
|
||||||
|
|
|
@ -85,7 +85,9 @@
|
||||||
"zone.js": "~0.7.2"
|
"zone.js": "~0.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"add-asset-html-webpack-plugin": "^1.0.2",
|
||||||
"codelyzer": "2.0.0-beta.4",
|
"codelyzer": "2.0.0-beta.4",
|
||||||
"standard": "^8.0.0"
|
"standard": "^8.0.0",
|
||||||
|
"webpack-dll-bundles-plugin": "^1.0.0-beta.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue