aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.common.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/config/webpack.common.js')
-rw-r--r--client/config/webpack.common.js54
1 files changed, 17 insertions, 37 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js
index 2ff3a1506..6edc9400c 100644
--- a/client/config/webpack.common.js
+++ b/client/config/webpack.common.js
@@ -5,7 +5,7 @@ const helpers = require('./helpers')
5 * Webpack Plugins 5 * Webpack Plugins
6 */ 6 */
7 7
8var CopyWebpackPlugin = (CopyWebpackPlugin = require('copy-webpack-plugin'), CopyWebpackPlugin.default || CopyWebpackPlugin) 8const CopyWebpackPlugin = require('copy-webpack-plugin')
9const HtmlWebpackPlugin = require('html-webpack-plugin') 9const HtmlWebpackPlugin = require('html-webpack-plugin')
10const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin 10const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin
11const WebpackNotifierPlugin = require('webpack-notifier') 11const WebpackNotifierPlugin = require('webpack-notifier')
@@ -15,7 +15,8 @@ const WebpackNotifierPlugin = require('webpack-notifier')
15 */ 15 */
16const METADATA = { 16const METADATA = {
17 title: 'PeerTube', 17 title: 'PeerTube',
18 baseUrl: '/' 18 baseUrl: '/',
19 isDevServer: helpers.isWebpackDevServer()
19} 20}
20 21
21/* 22/*
@@ -69,10 +70,7 @@ module.exports = {
69 root: helpers.root('src'), 70 root: helpers.root('src'),
70 71
71 // remove other default values 72 // remove other default values
72 modulesDirectories: [ 'node_modules' ], 73 modulesDirectories: [ 'node_modules' ]
73
74 packageAlias: 'browser'
75
76 }, 74 },
77 75
78 output: { 76 output: {
@@ -92,27 +90,15 @@ module.exports = {
92 */ 90 */
93 preLoaders: [ 91 preLoaders: [
94 92
95 /*
96 * Tslint loader support for *.ts files
97 *
98 * See: https://github.com/wbuchwalter/tslint-loader
99 */
100 // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] },
101
102 /*
103 * Source map loader support for *.js files
104 * Extracts SourceMaps for source files that as added as sourceMappingURL comment.
105 *
106 * See: https://github.com/webpack/source-map-loader
107 */
108 { 93 {
109 test: /\.js$/, 94 test: /\.ts$/,
110 loader: 'source-map-loader', 95 loader: 'string-replace-loader',
111 exclude: [ 96 query: {
112 // these packages have problems with their sourcemaps 97 search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)',
113 helpers.root('node_modules/rxjs'), 98 replace: '$1.import($3).then(mod => mod.__esModule ? mod.default : mod)',
114 helpers.root('node_modules/@angular') 99 flags: 'g'
115 ] 100 },
101 include: [helpers.root('src')]
116 } 102 }
117 103
118 ], 104 ],
@@ -134,7 +120,11 @@ module.exports = {
134 */ 120 */
135 { 121 {
136 test: /\.ts$/, 122 test: /\.ts$/,
137 loader: 'awesome-typescript-loader', 123 loaders: [
124 'awesome-typescript-loader',
125 'angular2-template-loader',
126 '@angularclass/hmr-loader'
127 ],
138 exclude: [/\.(spec|e2e)\.ts$/] 128 exclude: [/\.(spec|e2e)\.ts$/]
139 }, 129 },
140 130
@@ -194,16 +184,6 @@ module.exports = {
194 new ForkCheckerPlugin(), 184 new ForkCheckerPlugin(),
195 185
196 /* 186 /*
197 * Plugin: OccurenceOrderPlugin
198 * Description: Varies the distribution of the ids to get the smallest id length
199 * for often used ids.
200 *
201 * See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
202 * See: https://github.com/webpack/docs/wiki/optimization#minimize
203 */
204 new webpack.optimize.OccurenceOrderPlugin(true),
205
206 /*
207 * Plugin: CommonsChunkPlugin 187 * Plugin: CommonsChunkPlugin
208 * Description: Shares common code between the pages. 188 * Description: Shares common code between the pages.
209 * It identifies common modules and put them into a commons chunk. 189 * It identifies common modules and put them into a commons chunk.