aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.dev.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/config/webpack.dev.js')
-rw-r--r--client/config/webpack.dev.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 054757748..affb20f19 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -1,10 +1,12 @@
1const helpers = require('./helpers') 1const helpers = require('./helpers')
2const webpackMerge = require('webpack-merge') // used to merge webpack configs 2const webpackMerge = require('webpack-merge') // used to merge webpack configs
3const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'})
3const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev 4const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev
4 5
5/** 6/**
6 * Webpack Plugins 7 * Webpack Plugins
7 */ 8 */
9const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin')
8const DefinePlugin = require('webpack/lib/DefinePlugin') 10const DefinePlugin = require('webpack/lib/DefinePlugin')
9const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') 11const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
10const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') 12const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
@@ -23,6 +25,8 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, {
23 HMR: HMR 25 HMR: HMR
24}) 26})
25 27
28const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin
29
26/** 30/**
27 * Webpack configuration 31 * Webpack configuration
28 * 32 *
@@ -106,6 +110,52 @@ module.exports = function (env) {
106 } 110 }
107 }), 111 }),
108 112
113 new DllBundlesPlugin({
114 bundles: {
115 polyfills: [
116 'core-js',
117 {
118 name: 'zone.js',
119 path: 'zone.js/dist/zone.js'
120 },
121 {
122 name: 'zone.js',
123 path: 'zone.js/dist/long-stack-trace-zone.js'
124 },
125 'ts-helpers'
126 ],
127 vendor: [
128 '@angular/platform-browser',
129 '@angular/platform-browser-dynamic',
130 '@angular/core',
131 '@angular/common',
132 '@angular/forms',
133 '@angular/http',
134 '@angular/router',
135 '@angularclass/hmr',
136 'rxjs'
137 ]
138 },
139 dllDir: helpers.root('dll'),
140 webpackConfig: webpackMergeDll(commonConfig({env: ENV}), {
141 devtool: 'cheap-module-source-map',
142 plugins: []
143 })
144 }),
145
146 /**
147 * Plugin: AddAssetHtmlPlugin
148 * Description: Adds the given JS or CSS file to the files
149 * Webpack knows about, and put it into the list of assets
150 * html-webpack-plugin injects into the generated html.
151 *
152 * See: https://github.com/SimenB/add-asset-html-webpack-plugin
153 */
154 new AddAssetHtmlPlugin([
155 { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('polyfills')}`) },
156 { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('vendor')}`) }
157 ]),
158
109 /** 159 /**
110 * Plugin: NamedModulesPlugin (experimental) 160 * Plugin: NamedModulesPlugin (experimental)
111 * Description: Uses file names as module name. 161 * Description: Uses file names as module name.