aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-09-06 22:40:57 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-09-06 22:40:57 +0200
commitab32b0fc805b92c5a1d7ac5901cb1a38e94622ca (patch)
tree1749a7390cf0a726a179c5fa554053f5c0f0e51c /client/config
parent088a967fe0bc285aa7811515f6a9655e1144b9f9 (diff)
downloadPeerTube-ab32b0fc805b92c5a1d7ac5901cb1a38e94622ca.tar.gz
PeerTube-ab32b0fc805b92c5a1d7ac5901cb1a38e94622ca.tar.zst
PeerTube-ab32b0fc805b92c5a1d7ac5901cb1a38e94622ca.zip
Dirty update to Angular RC6
Diffstat (limited to 'client/config')
-rw-r--r--client/config/helpers.js5
-rw-r--r--client/config/webpack.common.js54
-rw-r--r--client/config/webpack.dev.js27
-rw-r--r--client/config/webpack.prod.js25
4 files changed, 57 insertions, 54 deletions
diff --git a/client/config/helpers.js b/client/config/helpers.js
index 24d7dae9f..6268d2628 100644
--- a/client/config/helpers.js
+++ b/client/config/helpers.js
@@ -8,10 +8,15 @@ function hasProcessFlag (flag) {
8 return process.argv.join('').indexOf(flag) > -1 8 return process.argv.join('').indexOf(flag) > -1
9} 9}
10 10
11function isWebpackDevServer () {
12 return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1]))
13}
14
11function root (args) { 15function root (args) {
12 args = Array.prototype.slice.call(arguments, 0) 16 args = Array.prototype.slice.call(arguments, 0)
13 return path.join.apply(path, [ROOT].concat(args)) 17 return path.join.apply(path, [ROOT].concat(args))
14} 18}
15 19
16exports.hasProcessFlag = hasProcessFlag 20exports.hasProcessFlag = hasProcessFlag
21exports.isWebpackDevServer = isWebpackDevServer
17exports.root = root 22exports.root = root
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.
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 50193bf58..fede16932 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -6,15 +6,18 @@ const commonConfig = require('./webpack.common.js') // the settings that are com
6 * Webpack Plugins 6 * Webpack Plugins
7 */ 7 */
8const DefinePlugin = require('webpack/lib/DefinePlugin') 8const DefinePlugin = require('webpack/lib/DefinePlugin')
9const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin')
9 10
10/** 11/**
11 * Webpack Constants 12 * Webpack Constants
12 */ 13 */
13const ENV = process.env.ENV = process.env.NODE_ENV = 'development' 14const ENV = process.env.ENV = process.env.NODE_ENV = 'development'
15const HOST = process.env.HOST || 'localhost'
16const PORT = process.env.PORT || 3000
14const HMR = helpers.hasProcessFlag('hot') 17const HMR = helpers.hasProcessFlag('hot')
15const METADATA = webpackMerge(commonConfig.metadata, { 18const METADATA = webpackMerge(commonConfig.metadata, {
16 host: 'localhost', 19 host: HOST,
17 port: 3000, 20 port: PORT,
18 ENV: ENV, 21 ENV: ENV,
19 HMR: HMR 22 HMR: HMR
20}) 23})
@@ -81,7 +84,10 @@ module.exports = webpackMerge(commonConfig, {
81 * 84 *
82 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename 85 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
83 */ 86 */
84 chunkFilename: '[id].chunk.js' 87 chunkFilename: '[id].chunk.js',
88
89 library: 'ac_[name]',
90 libraryTarget: 'var'
85 91
86 }, 92 },
87 93
@@ -109,7 +115,9 @@ module.exports = webpackMerge(commonConfig, {
109 'NODE_ENV': JSON.stringify(METADATA.ENV), 115 'NODE_ENV': JSON.stringify(METADATA.ENV),
110 'HMR': METADATA.HMR 116 'HMR': METADATA.HMR
111 } 117 }
112 }) 118 }),
119
120 new NamedModulesPlugin()
113 ], 121 ],
114 122
115 /** 123 /**
@@ -124,6 +132,17 @@ module.exports = webpackMerge(commonConfig, {
124 resourcePath: 'src' 132 resourcePath: 'src'
125 }, 133 },
126 134
135 devServer: {
136 port: METADATA.port,
137 host: METADATA.host,
138 historyApiFallback: true,
139 watchOptions: {
140 aggregateTimeout: 300,
141 poll: 1000
142 },
143 outputPath: helpers.root('dist')
144 },
145
127 /* 146 /*
128 * Include polyfills or mocks for various node stuff 147 * Include polyfills or mocks for various node stuff
129 * Description: Node configuration 148 * Description: Node configuration
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js
index 7ce5727d3..4e7d96a4b 100644
--- a/client/config/webpack.prod.js
+++ b/client/config/webpack.prod.js
@@ -9,10 +9,12 @@ const commonConfig = require('./webpack.common.js') // the settings that are com
9/** 9/**
10 * Webpack Plugins 10 * Webpack Plugins
11 */ 11 */
12// const ProvidePlugin = require('webpack/lib/ProvidePlugin')
12const DefinePlugin = require('webpack/lib/DefinePlugin') 13const DefinePlugin = require('webpack/lib/DefinePlugin')
13const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') 14const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
15// const IgnorePlugin = require('webpack/lib/IgnorePlugin')
16// const DedupePlugin = require('webpack/lib/optimize/DedupePlugin')
14const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') 17const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
15const CompressionPlugin = require('compression-webpack-plugin')
16const WebpackMd5Hash = require('webpack-md5-hash') 18const WebpackMd5Hash = require('webpack-md5-hash')
17 19
18/** 20/**
@@ -110,7 +112,7 @@ module.exports = webpackMerge(commonConfig, {
110 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin 112 * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin
111 * See: https://github.com/webpack/docs/wiki/optimization#deduplication 113 * See: https://github.com/webpack/docs/wiki/optimization#deduplication
112 */ 114 */
113 new DedupePlugin(), 115 // new DedupePlugin(),
114 116
115 /** 117 /**
116 * Plugin: DefinePlugin 118 * Plugin: DefinePlugin
@@ -156,19 +158,16 @@ module.exports = webpackMerge(commonConfig, {
156 // comments: true, //debug 158 // comments: true, //debug
157 159
158 beautify: false, // prod 160 beautify: false, // prod
159 161 mangle: { screw_ie8: true, keep_fnames: true }, // prod
160 mangle: { 162 compress: { screw_ie8: true }, // prod
161 screw_ie8: true,
162 keep_fnames: true
163 }, // prod
164
165 compress: {
166 screw_ie8: true
167 }, // prod
168
169 comments: false // prod 163 comments: false // prod
170 }), 164 }),
171 165
166 new NormalModuleReplacementPlugin(
167 /angular2-hmr/,
168 helpers.root('config/modules/angular2-hmr-prod.js')
169 ),
170
172 /** 171 /**
173 * Plugin: CompressionPlugin 172 * Plugin: CompressionPlugin
174 * Description: Prepares compressed versions of assets to serve 173 * Description: Prepares compressed versions of assets to serve