diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-01-19 21:54:40 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-01-19 21:54:40 +0100 |
commit | cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00 (patch) | |
tree | d9f82e495dd3ab31d4b363101594dfd818036547 /client/config/webpack.dev.js | |
parent | be3bac3afb88560c0112aab92f64eef06f9d042d (diff) | |
download | PeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.tar.gz PeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.tar.zst PeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.zip |
Client: add dll support
Diffstat (limited to 'client/config/webpack.dev.js')
-rw-r--r-- | client/config/webpack.dev.js | 50 |
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 @@ | |||
1 | const helpers = require('./helpers') | 1 | const helpers = require('./helpers') |
2 | const webpackMerge = require('webpack-merge') // used to merge webpack configs | 2 | const webpackMerge = require('webpack-merge') // used to merge webpack configs |
3 | const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'}) | ||
3 | const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev | 4 | const 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 | */ |
9 | const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin') | ||
8 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 10 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
9 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') | 11 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') |
10 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | 12 | const 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 | ||
28 | const 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. |