Skip to content

Commit 542b5b1

Browse files
committed
updated webpack configs
1 parent 01cce71 commit 542b5b1

File tree

4 files changed

+65
-51
lines changed

4 files changed

+65
-51
lines changed

config/webpack.aot.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
const helpers = require('./helpers');
2-
const webpack = require('webpack');
32
const webpackMerge = require('webpack-merge');
43
const commonConfig = require('./webpack.common.js');
54

5+
const DefinePlugin = require('webpack/lib/DefinePlugin');
6+
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
7+
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
8+
69
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
7-
const PUBLIC_PATH = (process.env.PUBLIC_PATH || '') + '/' ;
10+
const PUBLIC_PATH = (process.env.PUBLIC_PATH || '') + '/';
811

912
module.exports = webpackMerge(commonConfig, {
1013
entry: {
@@ -29,20 +32,34 @@ module.exports = webpackMerge(commonConfig, {
2932
publicPath: PUBLIC_PATH,
3033
},
3134
plugins: [
32-
new webpack.DefinePlugin({
35+
new DefinePlugin({
3336
'ENV': JSON.stringify(ENV),
3437
}),
35-
new webpack.LoaderOptionsPlugin({
38+
new LoaderOptionsPlugin({
3639
minimize: true,
3740
debug: false
3841
}),
39-
new webpack.optimize.UglifyJsPlugin({
42+
new UglifyJsPlugin({
43+
beautify: false,
44+
output: {
45+
comments: false
46+
},
47+
mangle: {
48+
screw_ie8: true
49+
},
4050
compress: {
41-
warnings: false
51+
screw_ie8: true,
52+
warnings: false,
53+
conditionals: true,
54+
unused: true,
55+
comparisons: true,
56+
sequences: true,
57+
dead_code: true,
58+
evaluate: true,
59+
if_return: true,
60+
join_vars: true,
61+
negate_iife: false, // we need this for lazy v8
4262
},
43-
beautify: false,
44-
comments: false,
45-
sourceMap: true
4663
}),
4764
],
4865
node: {

config/webpack.common.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
const webpack = require('webpack');
21
const helpers = require('./helpers');
32

4-
const HtmlWebpackPlugin = require('html-webpack-plugin');
53
const {CheckerPlugin} = require('awesome-typescript-loader');
4+
const HtmlWebpackPlugin = require('html-webpack-plugin');
65
const ExtractTextPlugin = require("extract-text-webpack-plugin");
6+
const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
7+
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
78

89
module.exports = {
910
entry: {
@@ -48,12 +49,12 @@ module.exports = {
4849
chunksSortMode: 'dependency',
4950
}),
5051
new CheckerPlugin(),
51-
new webpack.ContextReplacementPlugin(
52+
new ContextReplacementPlugin(
5253
// The (\\|\/) piece accounts for path separators in *nix and Windows
5354
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
5455
helpers.root('src') // location of your src
5556
),
56-
new webpack.optimize.CommonsChunkPlugin({
57+
new CommonsChunkPlugin({
5758
name: ['polyfills', 'vendor'].reverse()
5859
}),
5960
new ExtractTextPlugin('[name].[chunkhash].css'),

config/webpack.dev.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const helpers = require('./helpers');
2-
const webpack = require('webpack');
32
const webpackMerge = require('webpack-merge');
43
const commonConfig = require('./webpack.common.js');
54

5+
const DefinePlugin = require('webpack/lib/DefinePlugin');
6+
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
7+
68
const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
79

810
module.exports = webpackMerge(commonConfig, {
@@ -16,17 +18,11 @@ module.exports = webpackMerge(commonConfig, {
1618
publicPath: 'http://localhost:4200/',
1719
},
1820
plugins: [
19-
new webpack.DefinePlugin({
21+
new DefinePlugin({
2022
'ENV': JSON.stringify(ENV),
2123
}),
22-
new webpack.LoaderOptionsPlugin({
23-
options: {
24-
tslint: {
25-
emitErrors: false,
26-
failOnHint: false,
27-
resourcePath: 'src'
28-
},
29-
},
24+
new LoaderOptionsPlugin({
25+
debug: true,
3026
}),
3127
],
3228
devServer: {

yarn.lock

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
resolved "https://registry.yarnpkg.com/@types/jasmine/-/jasmine-2.5.40.tgz#875c7ae739dcab1342794f51231c4aadcda6eb79"
7070

7171
"@types/lodash@^4.14.38":
72-
version "4.14.48"
73-
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.%3Cspan%20class="x x-first x-last">48.tgz#d4d7747c28c63581e803bb2d03d0f0f36d2ac624"
72+
version "4.14.50"
73+
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.%3Cspan%20class="x x-first x-last">50.tgz#2227da4d65fafe249bccd59c7b9396e27674c8f7"
7474

7575
"@types/node@^7.0.0":
7676
version "7.0.0"
@@ -95,8 +95,8 @@
9595
"@types/source-map" "*"
9696

9797
"@types/webpack@^2.0.0":
98-
version "2.1.0"
99-
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-2.%3Cspan%20class="x x-first x-last">1.0.tgz#b94c93d139af80a1766ead206a7a20945ecec689"
98+
version "2.2.0"
99+
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-2.%3Cspan%20class="x x-first x-last">2.0.tgz#da0646a2093d6405950a58597e3e7eabdc755207"
100100
dependencies:
101101
"@types/tapable" "*"
102102
"@types/uglify-js" "*"
@@ -179,8 +179,8 @@ ansi-align@^1.1.0:
179179
string-width "^1.0.1"
180180

181181
ansi-regex@^2.0.0:
182-
version "2.0.0"
183-
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.%3Cspan%20class="x x-first x-last">0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107"
182+
version "2.1.1"
183+
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.%3Cspan%20class="x x-first x-last">1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
184184

185185
ansi-styles@^2.2.1:
186186
version "2.2.1"
@@ -301,7 +301,7 @@ async-each@^1.0.0:
301301
version "1.0.1"
302302
resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
303303

304-
[email protected], async@^1.4.0, async@^1.5.0, async@^1.5.2:
304+
[email protected], async@^1.4.0, async@^1.5.2:
305305
version "1.5.2"
306306
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
307307

@@ -704,8 +704,8 @@ caniuse-api@^1.5.2:
704704
shelljs "^0.7.0"
705705

706706
caniuse-db@^1.0.30000346, caniuse-db@^1.0.30000604:
707-
version "1.0.30000605"
708-
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.%3Cspan%20class="x x-first x-last">30000605.tgz#c616e335a6df02f865af5e02add72c897cb6579d"
707+
version "1.0.30000609"
708+
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.%3Cspan%20class="x x-first x-last">30000609.tgz#8c141ef09e8c66b7cb6c2b288fa931cc331e38c6"
709709

710710
capture-stack-trace@^1.0.0:
711711
version "1.0.0"
@@ -1563,10 +1563,10 @@ extglob@^0.3.1:
15631563
is-extglob "^1.0.0"
15641564

15651565
extract-text-webpack-plugin@^2.0.0-beta.4:
1566-
version "2.0.0-beta.4"
1567-
resolved "https://registry.yarnpkg.com/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.0.0-beta.%3Cspan%20class="x x-first x-last">4.tgz#d32393069e7d90c8318d48392302618b56bc1ba9"
1566+
version "2.0.0-beta.5"
1567+
resolved "https://registry.yarnpkg.com/extract-text-webpack-plugin/-/extract-text-webpack-plugin-2.0.0-beta.%3Cspan%20class="x x-first x-last">5.tgz#595e32ae2466ad2129a928328485fcc064ce57f0"
15681568
dependencies:
1569-
async "^1.5.0"
1569+
async "^2.1.2"
15701570
loader-utils "^0.2.3"
15711571
webpack-sources "^0.1.0"
15721572

@@ -3373,8 +3373,8 @@ postcss-merge-idents@^2.1.5:
33733373
postcss-value-parser "^3.1.1"
33743374

33753375
postcss-merge-longhand@^2.0.1:
3376-
version "2.0.1"
3377-
resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-2.0.%3Cspan%20class="x x-first x-last">1.tgz#ff59b5dec6d586ce2cea183138f55c5876fa9cdc"
3376+
version "2.0.2"
3377+
resolved "https://registry.yarnpkg.com/postcss-merge-longhand/-/postcss-merge-longhand-2.0.%3Cspan%20class="x x-first x-last">2.tgz#23d90cd127b0a77994915332739034a1a4f3d658"
33783378
dependencies:
33793379
postcss "^5.0.4"
33803380

@@ -3533,8 +3533,8 @@ postcss-zindex@^2.0.1:
35333533
uniqs "^2.0.0"
35343534

35353535
postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0.14, postcss@^5.0.16, postcss@^5.0.2, postcss@^5.0.4, postcss@^5.0.5, postcss@^5.0.6, postcss@^5.0.8, postcss@^5.2.8:
3536-
version "5.2.9"
3537-
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.%3Cspan%20class="x x-first x-last">9.tgz#282a644f92d4b871ade2d3ce8bd0ea46f18317b6"
3536+
version "5.2.10"
3537+
resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.%3Cspan%20class="x x-first x-last">10.tgz#b58b64e04f66f838b7bc7cb41f7dac168568a945"
35383538
dependencies:
35393539
chalk "^1.1.3"
35403540
js-base64 "^2.1.9"
@@ -3614,8 +3614,8 @@ qs@~6.3.0:
36143614
resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442"
36153615

36163616
query-string@^4.1.0:
3617-
version "4.2.3"
3618-
resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.%3Cspan%20class="x x-first x-last">2.3.tgz#9f27273d207a25a8ee4c7b8c74dcd45d556db822"
3617+
version "4.3.1"
3618+
resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.%3Cspan%20class="x x-first x-last">3.1.tgz#54baada6713eafc92be75c47a731f2ebd09cd11d"
36193619
dependencies:
36203620
object-assign "^4.1.0"
36213621
strict-uri-encode "^1.0.0"
@@ -4243,8 +4243,8 @@ sprintf-js@^1.0.3, sprintf-js@~1.0.2:
42434243
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
42444244

42454245
sshpk@^1.7.0:
4246-
version "1.10.1"
4247-
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.%3Cspan%20class="x x-first x-last">1.tgz#30e1a5d329244974a1af61511339d595af6638b0"
4246+
version "1.10.2"
4247+
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.%3Cspan%20class="x x-first x-last">2.tgz#d5a804ce22695515638e798dbe23273de070a5fa"
42484248
dependencies:
42494249
asn1 "~0.2.3"
42504250
assert-plus "^1.0.0"
@@ -4269,8 +4269,8 @@ stream-browserify@^2.0.1:
42694269
readable-stream "^2.0.2"
42704270

42714271
stream-http@^2.3.1:
4272-
version "2.6.0"
4273-
resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.6.%3Cspan%20class="x x-first x-last">0.tgz#adf3309ced17624ebfb7ef13e6ac4cfe405a8b12"
4272+
version "2.6.1"
4273+
resolved "https://registry.yarnpkg.com/stream-http/-/stream-http-2.6.%3Cspan%20class="x x-first x-last">1.tgz#7d20fcdfebc16b16e4174e31dd94cd9c70f10e89"
42744274
dependencies:
42754275
builtin-status-codes "^3.0.0"
42764276
inherits "^2.0.1"
@@ -4455,8 +4455,8 @@ ts-helpers@^1.1.2:
44554455
resolved "https://registry.yarnpkg.com/ts-helpers/-/ts-helpers-1.1.2.tgz#fc69be9f1f3baed01fb1a0ef8d4cfe748814d835"
44564456

44574457
tsickle@^0.2:
4458-
version "0.2.3"
4459-
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.2.%3Cspan%20class="x x-first x-last">3.tgz#3e7d3ff74bbecdadc011cfd747f991dcfd6503af"
4458+
version "0.2.4"
4459+
resolved "https://registry.yarnpkg.com/tsickle/-/tsickle-0.2.%3Cspan%20class="x x-first x-last">4.tgz#98f4837bf45eb142a90fec751f8e30c6a5bc7c06"
44604460
dependencies:
44614461
minimist "^1.2.0"
44624462
mkdirp "^0.5.1"
@@ -4732,8 +4732,8 @@ webpack-dev-server@>=2.1.0-beta.11:
47324732
yargs "^6.0.0"
47334733

47344734
webpack-merge@^2.0.0:
4735-
version "2.3.1"
4736-
resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-2.%3Cspan%20class="x x-first x-last">3.1.tgz#152ff773c5fbc6e398015fdf75835de343c33777"
4735+
version "2.4.0"
4736+
resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-2.%3Cspan%20class="x x-first x-last">4.0.tgz#4c518d471632c29ae22e83687c2f42a9cd5f35ea"
47374737
dependencies:
47384738
lodash "^4.17.4"
47394739

@@ -4908,5 +4908,5 @@ [email protected]:
49084908
resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"
49094909

49104910
zone.js@^0.7.1:
4911-
version "0.7.4"
4912-
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.%3Cspan%20class="x x-first x-last">4.tgz#0e624fe5b724450ee433495deff15c02b3908ee0"
4911+
version "0.7.5"
4912+
resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.7.%3Cspan%20class="x x-first x-last">5.tgz#bca7cce46ba3216e8631cff36591c4e62cb27104"

0 commit comments

Comments
 (0)