aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-19 21:54:40 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-19 21:54:40 +0100
commitcc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00 (patch)
treed9f82e495dd3ab31d4b363101594dfd818036547 /client
parentbe3bac3afb88560c0112aab92f64eef06f9d042d (diff)
downloadPeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.tar.gz
PeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.tar.zst
PeerTube-cc3e2d9b7a433c92cb5d4ec8e1fada9f34d79f00.zip
Client: add dll support
Diffstat (limited to 'client')
-rw-r--r--client/.gitignore1
-rw-r--r--client/config/webpack.common.js2
-rw-r--r--client/config/webpack.dev.js50
-rw-r--r--client/package.json4
4 files changed, 55 insertions, 2 deletions
diff --git a/client/.gitignore b/client/.gitignore
index fa5433194..255af83ff 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -2,3 +2,4 @@
2/node_modules 2/node_modules
3/compiled 3/compiled
4/stats.json 4/stats.json
5/dll
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js
index 09d6f72b5..223f55c2e 100644
--- a/client/config/webpack.common.js
+++ b/client/config/webpack.common.js
@@ -323,7 +323,7 @@ module.exports = function (options) {
323 * See: https://webpack.github.io/docs/configuration.html#node 323 * See: https://webpack.github.io/docs/configuration.html#node
324 */ 324 */
325 node: { 325 node: {
326 global: 'true', 326 global: true,
327 crypto: 'empty', 327 crypto: 'empty',
328 process: true, 328 process: true,
329 module: false, 329 module: false,
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.
diff --git a/client/package.json b/client/package.json
index 3137af680..ea458f1d4 100644
--- a/client/package.json
+++ b/client/package.json
@@ -85,7 +85,9 @@
85 "zone.js": "~0.7.2" 85 "zone.js": "~0.7.2"
86 }, 86 },
87 "devDependencies": { 87 "devDependencies": {
88 "add-asset-html-webpack-plugin": "^1.0.2",
88 "codelyzer": "2.0.0-beta.4", 89 "codelyzer": "2.0.0-beta.4",
89 "standard": "^8.0.0" 90 "standard": "^8.0.0",
91 "webpack-dll-bundles-plugin": "^1.0.0-beta.5"
90 } 92 }
91} 93}