diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 12:50:01 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-11-04 12:50:01 +0100 |
commit | 4d19d2f10b691650abe030d0dbb52dc7c8a62441 (patch) | |
tree | 2ec321237cb4c43948848418bc114559e0cc1ffe | |
parent | d05eb4ed10db5737173946cc15b1193ce498529b (diff) | |
download | PeerTube-4d19d2f10b691650abe030d0dbb52dc7c8a62441.tar.gz PeerTube-4d19d2f10b691650abe030d0dbb52dc7c8a62441.tar.zst PeerTube-4d19d2f10b691650abe030d0dbb52dc7c8a62441.zip |
Update to webpack beta 25
-rw-r--r-- | client/config/webpack.common.js | 88 | ||||
-rw-r--r-- | client/config/webpack.dev.js | 159 | ||||
-rw-r--r-- | client/config/webpack.prod.js | 204 | ||||
-rw-r--r-- | client/package.json | 3 | ||||
-rw-r--r-- | client/src/index.html | 9 |
5 files changed, 251 insertions, 212 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 882013a9e..5ef5621e6 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js | |||
@@ -10,6 +10,8 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') | |||
10 | const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin | 10 | const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin |
11 | const AssetsPlugin = require('assets-webpack-plugin') | 11 | const AssetsPlugin = require('assets-webpack-plugin') |
12 | const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') | 12 | const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') |
13 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | ||
14 | const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') | ||
13 | const WebpackNotifierPlugin = require('webpack-notifier') | 15 | const WebpackNotifierPlugin = require('webpack-notifier') |
14 | 16 | ||
15 | /* | 17 | /* |
@@ -30,12 +32,6 @@ module.exports = function (options) { | |||
30 | var isProd = options.env === 'production' | 32 | var isProd = options.env === 'production' |
31 | 33 | ||
32 | return { | 34 | return { |
33 | /* | ||
34 | * Static metadata for index.html | ||
35 | * | ||
36 | * See: (custom attribute) | ||
37 | */ | ||
38 | metadata: METADATA, | ||
39 | 35 | ||
40 | /* | 36 | /* |
41 | * Cache generated modules and chunks to improve performance for multiple incremental builds. | 37 | * Cache generated modules and chunks to improve performance for multiple incremental builds. |
@@ -69,17 +65,9 @@ module.exports = function (options) { | |||
69 | * | 65 | * |
70 | * See: http://webpack.github.io/docs/configuration.html#resolve-extensions | 66 | * See: http://webpack.github.io/docs/configuration.html#resolve-extensions |
71 | */ | 67 | */ |
72 | extensions: [ '', '.ts', '.js', '.scss' ], | 68 | extensions: [ '.ts', '.js', '.json', '.scss' ], |
73 | |||
74 | // Make sure root is src | ||
75 | root: helpers.root('src'), | ||
76 | 69 | ||
77 | // remove other default values | 70 | modules: [helpers.root('src'), 'node_modules'] |
78 | modulesDirectories: [ 'node_modules' ] | ||
79 | }, | ||
80 | |||
81 | output: { | ||
82 | publicPath: '/client/' | ||
83 | }, | 71 | }, |
84 | 72 | ||
85 | /* | 73 | /* |
@@ -88,33 +76,8 @@ module.exports = function (options) { | |||
88 | * See: http://webpack.github.io/docs/configuration.html#module | 76 | * See: http://webpack.github.io/docs/configuration.html#module |
89 | */ | 77 | */ |
90 | module: { | 78 | module: { |
91 | /* | ||
92 | * An array of applied pre and post loaders. | ||
93 | * | ||
94 | * See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders | ||
95 | */ | ||
96 | preLoaders: [ | ||
97 | { | ||
98 | test: /\.ts$/, | ||
99 | loader: 'string-replace-loader', | ||
100 | query: { | ||
101 | search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)', | ||
102 | replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)', | ||
103 | flags: 'g' | ||
104 | }, | ||
105 | include: [helpers.root('src')] | ||
106 | } | ||
107 | ], | ||
108 | 79 | ||
109 | /* | 80 | rules: [ |
110 | * An array of automatically applied loaders. | ||
111 | * | ||
112 | * IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. | ||
113 | * This means they are not resolved relative to the configuration file. | ||
114 | * | ||
115 | * See: http://webpack.github.io/docs/configuration.html#module-loaders | ||
116 | */ | ||
117 | loaders: [ | ||
118 | 81 | ||
119 | /* | 82 | /* |
120 | * Typescript loader support for .ts and Angular 2 async routes via .async.ts | 83 | * Typescript loader support for .ts and Angular 2 async routes via .async.ts |
@@ -163,10 +126,6 @@ module.exports = function (options) { | |||
163 | 126 | ||
164 | }, | 127 | }, |
165 | 128 | ||
166 | sassLoader: { | ||
167 | precision: 10 | ||
168 | }, | ||
169 | |||
170 | /* | 129 | /* |
171 | * Add additional plugins to the compiler. | 130 | * Add additional plugins to the compiler. |
172 | * | 131 | * |
@@ -205,7 +164,7 @@ module.exports = function (options) { | |||
205 | * | 164 | * |
206 | * See: https://webpack.github.io/docs/list-of-plugins.html#contextreplacementplugin | 165 | * See: https://webpack.github.io/docs/list-of-plugins.html#contextreplacementplugin |
207 | * See: https://github.com/angular/angular/issues/11580 | 166 | * See: https://github.com/angular/angular/issues/11580 |
208 | */ | 167 | */ |
209 | new ContextReplacementPlugin( | 168 | new ContextReplacementPlugin( |
210 | // The (\\|\/) piece accounts for path separators in *nix and Windows | 169 | // The (\\|\/) piece accounts for path separators in *nix and Windows |
211 | /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, | 170 | /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, |
@@ -241,10 +200,36 @@ module.exports = function (options) { | |||
241 | */ | 200 | */ |
242 | new HtmlWebpackPlugin({ | 201 | new HtmlWebpackPlugin({ |
243 | template: 'src/index.html', | 202 | template: 'src/index.html', |
244 | chunksSortMode: 'dependency' | 203 | title: METADATA.title, |
204 | chunksSortMode: 'dependency', | ||
205 | metadata: METADATA | ||
206 | }), | ||
207 | |||
208 | /* | ||
209 | * Plugin: ScriptExtHtmlWebpackPlugin | ||
210 | * Description: Enhances html-webpack-plugin functionality | ||
211 | * with different deployment options for your scripts including: | ||
212 | * | ||
213 | * See: https://github.com/numical/script-ext-html-webpack-plugin | ||
214 | */ | ||
215 | new ScriptExtHtmlWebpackPlugin({ | ||
216 | defaultAttribute: 'defer' | ||
245 | }), | 217 | }), |
246 | 218 | ||
247 | new WebpackNotifierPlugin({ alwaysNotify: true }) | 219 | new WebpackNotifierPlugin({ alwaysNotify: true }), |
220 | |||
221 | /** | ||
222 | * Plugin LoaderOptionsPlugin (experimental) | ||
223 | * | ||
224 | * See: https://gist.github.com/sokra/27b24881210b56bbaff7 | ||
225 | */ | ||
226 | new LoaderOptionsPlugin({ | ||
227 | options: { | ||
228 | sassLoader: { | ||
229 | precision: 10 | ||
230 | } | ||
231 | } | ||
232 | }) | ||
248 | ], | 233 | ], |
249 | 234 | ||
250 | /* | 235 | /* |
@@ -254,10 +239,9 @@ module.exports = function (options) { | |||
254 | * See: https://webpack.github.io/docs/configuration.html#node | 239 | * See: https://webpack.github.io/docs/configuration.html#node |
255 | */ | 240 | */ |
256 | node: { | 241 | node: { |
257 | global: 'window', | 242 | global: 'true', |
258 | crypto: 'empty', | 243 | crypto: 'empty', |
259 | fs: 'empty', | 244 | process: true, |
260 | events: true, | ||
261 | module: false, | 245 | module: false, |
262 | clearImmediate: false, | 246 | clearImmediate: false, |
263 | setImmediate: false | 247 | setImmediate: false |
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 0b6c00cbd..964ea56a5 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js | |||
@@ -7,6 +7,7 @@ const commonConfig = require('./webpack.common.js') // the settings that are com | |||
7 | */ | 7 | */ |
8 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 8 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
9 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') | 9 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') |
10 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | ||
10 | 11 | ||
11 | /** | 12 | /** |
12 | * Webpack Constants | 13 | * Webpack Constants |
@@ -30,66 +31,53 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { | |||
30 | module.exports = function (env) { | 31 | module.exports = function (env) { |
31 | return webpackMerge(commonConfig({env: ENV}), { | 32 | return webpackMerge(commonConfig({env: ENV}), { |
32 | /** | 33 | /** |
33 | * Merged metadata from webpack.common.js for index.html | 34 | * Developer tool to enhance debugging |
34 | * | 35 | * |
35 | * See: (custom attribute) | 36 | * See: http://webpack.github.io/docs/configuration.html#devtool |
36 | */ | 37 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps |
37 | metadata: METADATA, | 38 | */ |
38 | |||
39 | /** | ||
40 | * Switch loaders to debug mode. | ||
41 | * | ||
42 | * See: http://webpack.github.io/docs/configuration.html#debug | ||
43 | */ | ||
44 | debug: true, | ||
45 | |||
46 | /** | ||
47 | * Developer tool to enhance debugging | ||
48 | * | ||
49 | * See: http://webpack.github.io/docs/configuration.html#devtool | ||
50 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
51 | */ | ||
52 | devtool: 'cheap-module-source-map', | 39 | devtool: 'cheap-module-source-map', |
53 | 40 | ||
54 | /** | 41 | /** |
55 | * Options affecting the output of the compilation. | 42 | * Options affecting the output of the compilation. |
56 | * | 43 | * |
57 | * See: http://webpack.github.io/docs/configuration.html#output | 44 | * See: http://webpack.github.io/docs/configuration.html#output |
58 | */ | 45 | */ |
59 | output: { | 46 | output: { |
60 | /** | 47 | /** |
61 | * The output directory as absolute path (required). | 48 | * The output directory as absolute path (required). |
62 | * | 49 | * |
63 | * See: http://webpack.github.io/docs/configuration.html#output-path | 50 | * See: http://webpack.github.io/docs/configuration.html#output-path |
64 | */ | 51 | */ |
65 | path: helpers.root('dist'), | 52 | path: helpers.root('dist'), |
66 | 53 | ||
67 | /** | 54 | /** |
68 | * Specifies the name of each output file on disk. | 55 | * Specifies the name of each output file on disk. |
69 | * IMPORTANT: You must not specify an absolute path here! | 56 | * IMPORTANT: You must not specify an absolute path here! |
70 | * | 57 | * |
71 | * See: http://webpack.github.io/docs/configuration.html#output-filename | 58 | * See: http://webpack.github.io/docs/configuration.html#output-filename |
72 | */ | 59 | */ |
73 | filename: '[name].bundle.js', | 60 | filename: '[name].bundle.js', |
74 | 61 | ||
75 | /** | 62 | /** |
76 | * The filename of the SourceMaps for the JavaScript files. | 63 | * The filename of the SourceMaps for the JavaScript files. |
77 | * They are inside the output.path directory. | 64 | * They are inside the output.path directory. |
78 | * | 65 | * |
79 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | 66 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename |
80 | */ | 67 | */ |
81 | sourceMapFilename: '[name].map', | 68 | sourceMapFilename: '[name].map', |
82 | 69 | ||
83 | /** The filename of non-entry chunks as relative path | 70 | /** The filename of non-entry chunks as relative path |
84 | * inside the output.path directory. | 71 | * inside the output.path directory. |
85 | * | 72 | * |
86 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | 73 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename |
87 | */ | 74 | */ |
88 | chunkFilename: '[id].chunk.js', | 75 | chunkFilename: '[id].chunk.js', |
89 | 76 | ||
90 | library: 'ac_[name]', | 77 | library: 'ac_[name]', |
91 | libraryTarget: 'var' | 78 | libraryTarget: 'var', |
92 | 79 | ||
80 | publicPath: '/client/' | ||
93 | }, | 81 | }, |
94 | 82 | ||
95 | externals: { | 83 | externals: { |
@@ -99,14 +87,14 @@ module.exports = function (env) { | |||
99 | plugins: [ | 87 | plugins: [ |
100 | 88 | ||
101 | /** | 89 | /** |
102 | * Plugin: DefinePlugin | 90 | * Plugin: DefinePlugin |
103 | * Description: Define free variables. | 91 | * Description: Define free variables. |
104 | * Useful for having development builds with debug logging or adding global constants. | 92 | * Useful for having development builds with debug logging or adding global constants. |
105 | * | 93 | * |
106 | * Environment helpers | 94 | * Environment helpers |
107 | * | 95 | * |
108 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | 96 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin |
109 | */ | 97 | */ |
110 | // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts | 98 | // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts |
111 | new DefinePlugin({ | 99 | new DefinePlugin({ |
112 | 'ENV': JSON.stringify(METADATA.ENV), | 100 | 'ENV': JSON.stringify(METADATA.ENV), |
@@ -118,21 +106,56 @@ module.exports = function (env) { | |||
118 | } | 106 | } |
119 | }), | 107 | }), |
120 | 108 | ||
121 | new NamedModulesPlugin() | 109 | /** |
110 | * Plugin: NamedModulesPlugin (experimental) | ||
111 | * Description: Uses file names as module name. | ||
112 | * | ||
113 | * See: https://github.com/webpack/webpack/commit/a04ffb928365b19feb75087c63f13cadfc08e1eb | ||
114 | */ | ||
115 | new NamedModulesPlugin(), | ||
116 | |||
117 | /** | ||
118 | * Plugin LoaderOptionsPlugin (experimental) | ||
119 | * | ||
120 | * See: https://gist.github.com/sokra/27b24881210b56bbaff7 | ||
121 | */ | ||
122 | new LoaderOptionsPlugin({ | ||
123 | debug: true, | ||
124 | options: { | ||
125 | |||
126 | /** | ||
127 | * Static analysis linter for TypeScript advanced options configuration | ||
128 | * Description: An extensible linter for the TypeScript language. | ||
129 | * | ||
130 | * See: https://github.com/wbuchwalter/tslint-loader | ||
131 | */ | ||
132 | tslint: { | ||
133 | emitErrors: false, | ||
134 | failOnHint: false, | ||
135 | resourcePath: 'src' | ||
136 | }, | ||
137 | |||
138 | // FIXME: Remove | ||
139 | // https://github.com/bholloway/resolve-url-loader/issues/36 | ||
140 | // https://github.com/jtangelder/sass-loader/issues/289 | ||
141 | context: __dirname, | ||
142 | output: { | ||
143 | path: helpers.root('dist') | ||
144 | } | ||
145 | |||
146 | } | ||
147 | }) | ||
148 | |||
122 | ], | 149 | ], |
123 | 150 | ||
124 | /** | 151 | /** |
125 | * Static analysis linter for TypeScript advanced options configuration | 152 | * Webpack Development Server configuration |
126 | * Description: An extensible linter for the TypeScript language. | 153 | * Description: The webpack-dev-server is a little node.js Express server. |
127 | * | 154 | * The server emits information about the compilation state to the client, |
128 | * See: https://github.com/wbuchwalter/tslint-loader | 155 | * which reacts to those events. |
129 | */ | 156 | * |
130 | tslint: { | 157 | * See: https://webpack.github.io/docs/webpack-dev-server.html |
131 | emitErrors: false, | 158 | */ |
132 | failOnHint: false, | ||
133 | resourcePath: 'src' | ||
134 | }, | ||
135 | |||
136 | devServer: { | 159 | devServer: { |
137 | port: METADATA.port, | 160 | port: METADATA.port, |
138 | host: METADATA.host, | 161 | host: METADATA.host, |
@@ -145,13 +168,13 @@ module.exports = function (env) { | |||
145 | }, | 168 | }, |
146 | 169 | ||
147 | /* | 170 | /* |
148 | * Include polyfills or mocks for various node stuff | 171 | * Include polyfills or mocks for various node stuff |
149 | * Description: Node configuration | 172 | * Description: Node configuration |
150 | * | 173 | * |
151 | * See: https://webpack.github.io/docs/configuration.html#node | 174 | * See: https://webpack.github.io/docs/configuration.html#node |
152 | */ | 175 | */ |
153 | node: { | 176 | node: { |
154 | global: 'window', | 177 | global: true, |
155 | crypto: 'empty', | 178 | crypto: 'empty', |
156 | process: true, | 179 | process: true, |
157 | module: false, | 180 | module: false, |
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js index 46db54482..ce6886af6 100644 --- a/client/config/webpack.prod.js +++ b/client/config/webpack.prod.js | |||
@@ -12,6 +12,7 @@ const commonConfig = require('./webpack.common.js') // the settings that are com | |||
12 | // const ProvidePlugin = require('webpack/lib/ProvidePlugin') | 12 | // const ProvidePlugin = require('webpack/lib/ProvidePlugin') |
13 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 13 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
14 | const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') | 14 | const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') |
15 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | ||
15 | // const IgnorePlugin = require('webpack/lib/IgnorePlugin') | 16 | // const IgnorePlugin = require('webpack/lib/IgnorePlugin') |
16 | // const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') | 17 | // const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') |
17 | const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') | 18 | const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') |
@@ -33,57 +34,52 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { | |||
33 | module.exports = function (env) { | 34 | module.exports = function (env) { |
34 | return webpackMerge(commonConfig({env: ENV}), { | 35 | return webpackMerge(commonConfig({env: ENV}), { |
35 | /** | 36 | /** |
36 | * Switch loaders to debug mode. | 37 | * Developer tool to enhance debugging |
37 | * | 38 | * |
38 | * See: http://webpack.github.io/docs/configuration.html#debug | 39 | * See: http://webpack.github.io/docs/configuration.html#devtool |
39 | */ | 40 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps |
40 | debug: false, | 41 | */ |
41 | |||
42 | /** | ||
43 | * Developer tool to enhance debugging | ||
44 | * | ||
45 | * See: http://webpack.github.io/docs/configuration.html#devtool | ||
46 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
47 | */ | ||
48 | devtool: 'source-map', | 42 | devtool: 'source-map', |
49 | 43 | ||
50 | /** | 44 | /** |
51 | * Options affecting the output of the compilation. | 45 | * Options affecting the output of the compilation. |
52 | * | 46 | * |
53 | * See: http://webpack.github.io/docs/configuration.html#output | 47 | * See: http://webpack.github.io/docs/configuration.html#output |
54 | */ | 48 | */ |
55 | output: { | 49 | output: { |
50 | |||
56 | /** | 51 | /** |
57 | * The output directory as absolute path (required). | 52 | * The output directory as absolute path (required). |
58 | * | 53 | * |
59 | * See: http://webpack.github.io/docs/configuration.html#output-path | 54 | * See: http://webpack.github.io/docs/configuration.html#output-path |
60 | */ | 55 | */ |
61 | path: helpers.root('dist'), | 56 | path: helpers.root('dist'), |
62 | 57 | ||
63 | /** | 58 | /** |
64 | * Specifies the name of each output file on disk. | 59 | * Specifies the name of each output file on disk. |
65 | * IMPORTANT: You must not specify an absolute path here! | 60 | * IMPORTANT: You must not specify an absolute path here! |
66 | * | 61 | * |
67 | * See: http://webpack.github.io/docs/configuration.html#output-filename | 62 | * See: http://webpack.github.io/docs/configuration.html#output-filename |
68 | */ | 63 | */ |
69 | filename: '[name].[chunkhash].bundle.js', | 64 | filename: '[name].[chunkhash].bundle.js', |
70 | 65 | ||
71 | /** | 66 | /** |
72 | * The filename of the SourceMaps for the JavaScript files. | 67 | * The filename of the SourceMaps for the JavaScript files. |
73 | * They are inside the output.path directory. | 68 | * They are inside the output.path directory. |
74 | * | 69 | * |
75 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | 70 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename |
76 | */ | 71 | */ |
77 | sourceMapFilename: '[name].[chunkhash].bundle.map', | 72 | sourceMapFilename: '[name].[chunkhash].bundle.map', |
78 | 73 | ||
79 | /** | 74 | /** |
80 | * The filename of non-entry chunks as relative path | 75 | * The filename of non-entry chunks as relative path |
81 | * inside the output.path directory. | 76 | * inside the output.path directory. |
82 | * | 77 | * |
83 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | 78 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename |
84 | */ | 79 | */ |
85 | chunkFilename: '[id].[chunkhash].chunk.js' | 80 | chunkFilename: '[id].[chunkhash].chunk.js', |
86 | 81 | ||
82 | publicPath: '/client/' | ||
87 | }, | 83 | }, |
88 | 84 | ||
89 | externals: { | 85 | externals: { |
@@ -134,14 +130,13 @@ module.exports = function (env) { | |||
134 | 'HMR': METADATA.HMR | 130 | 'HMR': METADATA.HMR |
135 | } | 131 | } |
136 | }), | 132 | }), |
137 | 133 | /** | |
138 | /** | 134 | * Plugin: UglifyJsPlugin |
139 | * Plugin: UglifyJsPlugin | 135 | * Description: Minimize all JavaScript output of chunks. |
140 | * Description: Minimize all JavaScript output of chunks. | 136 | * Loaders are switched into minimizing mode. |
141 | * Loaders are switched into minimizing mode. | 137 | * |
142 | * | 138 | * See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin |
143 | * See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin | 139 | */ |
144 | */ | ||
145 | // NOTE: To debug prod builds uncomment //debug lines and comment //prod lines | 140 | // NOTE: To debug prod builds uncomment //debug lines and comment //prod lines |
146 | new UglifyJsPlugin({ | 141 | new UglifyJsPlugin({ |
147 | // beautify: true, //debug | 142 | // beautify: true, //debug |
@@ -159,68 +154,101 @@ module.exports = function (env) { | |||
159 | // comments: true, //debug | 154 | // comments: true, //debug |
160 | 155 | ||
161 | beautify: false, // prod | 156 | beautify: false, // prod |
162 | mangle: { screw_ie8: true, keep_fnames: true }, // prod | 157 | mangle: { |
163 | compress: { screw_ie8: true }, // prod | 158 | screw_ie8: true, |
159 | keep_fnames: true | ||
160 | }, // prod | ||
161 | compress: { | ||
162 | screw_ie8: true | ||
163 | }, // prod | ||
164 | comments: false // prod | 164 | comments: false // prod |
165 | }), | 165 | }), |
166 | 166 | ||
167 | new NormalModuleReplacementPlugin( | 167 | new NormalModuleReplacementPlugin( |
168 | /angular2-hmr/, | 168 | /angular2-hmr/, |
169 | helpers.root('config/modules/angular2-hmr-prod.js') | 169 | helpers.root('config/modules/angular2-hmr-prod.js') |
170 | ) | 170 | ), |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * Plugin: CompressionPlugin | 173 | * Plugin: IgnorePlugin |
174 | * Description: Prepares compressed versions of assets to serve | 174 | * Description: Don’t generate modules for requests matching the provided RegExp. |
175 | * them with Content-Encoding | 175 | * |
176 | * | 176 | * See: http://webpack.github.io/docs/list-of-plugins.html#ignoreplugin |
177 | * See: https://github.com/webpack/compression-webpack-plugin | 177 | */ |
178 | */ | 178 | |
179 | // new IgnorePlugin(/angular2-hmr/), | ||
180 | |||
181 | /** | ||
182 | * Plugin: CompressionPlugin | ||
183 | * Description: Prepares compressed versions of assets to serve | ||
184 | * them with Content-Encoding | ||
185 | * | ||
186 | * See: https://github.com/webpack/compression-webpack-plugin | ||
187 | */ | ||
188 | // install compression-webpack-plugin | ||
179 | // new CompressionPlugin({ | 189 | // new CompressionPlugin({ |
180 | // regExp: /\.css$|\.html$|\.js$|\.map$/, | 190 | // regExp: /\.css$|\.html$|\.js$|\.map$/, |
181 | // threshold: 2 * 1024 | 191 | // threshold: 2 * 1024 |
182 | // }) | 192 | // }) |
183 | 193 | ||
184 | ], | 194 | /** |
195 | * Plugin LoaderOptionsPlugin (experimental) | ||
196 | * | ||
197 | * See: https://gist.github.com/sokra/27b24881210b56bbaff7 | ||
198 | */ | ||
199 | new LoaderOptionsPlugin({ | ||
200 | debug: false, | ||
201 | options: { | ||
185 | 202 | ||
186 | /** | 203 | /** |
187 | * Static analysis linter for TypeScript advanced options configuration | 204 | * Static analysis linter for TypeScript advanced options configuration |
188 | * Description: An extensible linter for the TypeScript language. | 205 | * Description: An extensible linter for the TypeScript language. |
189 | * | 206 | * |
190 | * See: https://github.com/wbuchwalter/tslint-loader | 207 | * See: https://github.com/wbuchwalter/tslint-loader |
191 | */ | 208 | */ |
192 | tslint: { | 209 | tslint: { |
193 | emitErrors: true, | 210 | emitErrors: true, |
194 | failOnHint: true, | 211 | failOnHint: true, |
195 | resourcePath: 'src' | 212 | resourcePath: 'src' |
196 | }, | 213 | }, |
197 | 214 | ||
198 | /** | 215 | /** |
199 | * Html loader advanced options | 216 | * Html loader advanced options |
200 | * | 217 | * |
201 | * See: https://github.com/webpack/html-loader#advanced-options | 218 | * See: https://github.com/webpack/html-loader#advanced-options |
202 | */ | 219 | */ |
203 | // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor | 220 | // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor |
204 | htmlLoader: { | 221 | htmlLoader: { |
205 | minimize: true, | 222 | minimize: true, |
206 | removeAttributeQuotes: false, | 223 | removeAttributeQuotes: false, |
207 | caseSensitive: true, | 224 | caseSensitive: true, |
208 | customAttrSurround: [ | 225 | customAttrSurround: [ |
209 | [/#/, /(?:)/], | 226 | [/#/, /(?:)/], |
210 | [/\*/, /(?:)/], | 227 | [/\*/, /(?:)/], |
211 | [/\[?\(?/, /(?:)/] | 228 | [/\[?\(?/, /(?:)/] |
212 | ], | 229 | ], |
213 | customAttrAssign: [/\)?\]?=/] | 230 | customAttrAssign: [/\)?\]?=/] |
214 | }, | 231 | }, |
232 | |||
233 | // FIXME: Remove | ||
234 | // https://github.com/bholloway/resolve-url-loader/issues/36 | ||
235 | // https://github.com/jtangelder/sass-loader/issues/289 | ||
236 | context: __dirname, | ||
237 | output: { | ||
238 | path: helpers.root('dist') | ||
239 | } | ||
240 | } | ||
241 | }) | ||
242 | ], | ||
215 | 243 | ||
216 | /* | 244 | /* |
217 | * Include polyfills or mocks for various node stuff | 245 | * Include polyfills or mocks for various node stuff |
218 | * Description: Node configuration | 246 | * Description: Node configuration |
219 | * | 247 | * |
220 | * See: https://webpack.github.io/docs/configuration.html#node | 248 | * See: https://webpack.github.io/docs/configuration.html#node |
221 | */ | 249 | */ |
222 | node: { | 250 | node: { |
223 | global: 'window', | 251 | global: true, |
224 | crypto: 'empty', | 252 | crypto: 'empty', |
225 | process: false, | 253 | process: false, |
226 | module: false, | 254 | module: false, |
diff --git a/client/package.json b/client/package.json index cf3cdd954..ab15d1ba3 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -60,6 +60,7 @@ | |||
60 | "resolve-url-loader": "^1.6.0", | 60 | "resolve-url-loader": "^1.6.0", |
61 | "rxjs": "^5.0.0-rc.1", | 61 | "rxjs": "^5.0.0-rc.1", |
62 | "sass-loader": "^4.0.2", | 62 | "sass-loader": "^4.0.2", |
63 | "script-ext-html-webpack-plugin": "^1.3.2", | ||
63 | "source-map-loader": "^0.1.5", | 64 | "source-map-loader": "^0.1.5", |
64 | "string-replace-loader": "^1.0.3", | 65 | "string-replace-loader": "^1.0.3", |
65 | "style-loader": "^0.13.1", | 66 | "style-loader": "^0.13.1", |
@@ -68,7 +69,7 @@ | |||
68 | "tslint-loader": "^2.1.4", | 69 | "tslint-loader": "^2.1.4", |
69 | "typescript": "^2.0.0", | 70 | "typescript": "^2.0.0", |
70 | "url-loader": "^0.5.7", | 71 | "url-loader": "^0.5.7", |
71 | "webpack": "2.1.0-beta.22", | 72 | "webpack": "2.1.0-beta.25", |
72 | "webpack-md5-hash": "0.0.5", | 73 | "webpack-md5-hash": "0.0.5", |
73 | "webpack-merge": "^0.15.0", | 74 | "webpack-merge": "^0.15.0", |
74 | "webpack-notifier": "^1.3.0", | 75 | "webpack-notifier": "^1.3.0", |
diff --git a/client/src/index.html b/client/src/index.html index f39d8d2cf..7ae8fc54f 100644 --- a/client/src/index.html +++ b/client/src/index.html | |||
@@ -1,9 +1,7 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <html> | 2 | <html> |
3 | <head> | 3 | <head> |
4 | <base href="/"> | 4 | <title><%= htmlWebpackPlugin.options.title %></title> |
5 | |||
6 | <title>PeerTube</title> | ||
7 | 5 | ||
8 | <meta charset="UTF-8"> | 6 | <meta charset="UTF-8"> |
9 | <meta name="viewport" content="width=device-width, initial-scale=1"> | 7 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
@@ -12,11 +10,16 @@ | |||
12 | 10 | ||
13 | <!-- TODO: bundle it with webpack when https://github.com/webpack/webpack/pull/1931 will be merged --> | 11 | <!-- TODO: bundle it with webpack when https://github.com/webpack/webpack/pull/1931 will be merged --> |
14 | <script src="/client/assets/webtorrent/webtorrent.min.js"></script> | 12 | <script src="/client/assets/webtorrent/webtorrent.min.js"></script> |
13 | |||
14 | <!-- base url --> | ||
15 | <base href="<%= htmlWebpackPlugin.options.metadata.baseUrl %>"> | ||
15 | </head> | 16 | </head> |
16 | 17 | ||
17 | <!-- 3. Display the application --> | 18 | <!-- 3. Display the application --> |
18 | <body> | 19 | <body> |
20 | |||
19 | <my-app> | 21 | <my-app> |
20 | </my-app> | 22 | </my-app> |
23 | |||
21 | </body> | 24 | </body> |
22 | </html> | 25 | </html> |