Skip to content

Commit 9d369c0

Browse files
committed
fix: dev build server
updated packages and fixed dev server closes #16
1 parent b869a77 commit 9d369c0

File tree

5 files changed

+85
-78
lines changed

5 files changed

+85
-78
lines changed

package.json

+18-20
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@
3232
"postinstall": "npm run webdriver-update"
3333
},
3434
"dependencies": {
35-
"@angular/common": "2.0.0",
36-
"@angular/compiler": "2.0.0",
37-
"@angular/core": "2.0.0",
38-
"@angular/forms": "2.0.0",
39-
"@angular/http": "2.0.0",
40-
"@angular/platform-browser": "2.0.0",
41-
"@angular/platform-browser-dynamic": "2.0.0",
42-
"@angular/router": "3.0.0",
35+
"@angular/common": "2.0.1",
36+
"@angular/compiler": "2.0.1",
37+
"@angular/core": "2.0.1",
38+
"@angular/forms": "2.0.1",
39+
"@angular/http": "2.0.1",
40+
"@angular/platform-browser": "2.0.1",
41+
"@angular/platform-browser-dynamic": "2.0.1",
42+
"@angular/router": "3.0.1",
4343
"core-js": "^2.4.1",
4444
"reflect-metadata": "^0.1.3",
4545
"rxjs": "5.0.0-beta.12",
4646
"zone.js": "^0.6.21"
4747
},
4848
"devDependencies": {
4949
"@angularclass/hmr": "^1.0.1",
50-
"@angularclass/hmr-loader": "^1.0.0",
50+
"@angularclass/hmr-loader": "^3.0.2",
5151
"@types/core-js": "^0.9.0",
5252
"@types/jasmine": "^2.2.29",
5353
"@types/node": "^6.0.38",
@@ -58,45 +58,43 @@
5858
"awesome-typescript-loader": "^2.2.4",
5959
"codelyzer": "0.0.26",
6060
"copy-webpack-plugin": "^3.0.0",
61-
"css-loader": "^0.23.0",
62-
"extract-text-webpack-plugin": "^1.0.1",
61+
"css-loader": "^0.25.0",
62+
"extract-text-webpack-plugin": "^2.0.0-beta.4",
6363
"file-loader": "^0.9.0",
6464
"html-loader": "^0.4.0",
6565
"html-webpack-plugin": "^2.8.1",
6666
"istanbul-instrumenter-loader": "^0.2.0",
6767
"jasmine-core": "^2.3.4",
6868
"jasmine-spec-reporter": "^2.4.0",
6969
"json-loader": "^0.5.3",
70-
"karma": "1.1.2",
71-
"karma-chrome-launcher": "^1.0.1",
70+
"karma": "1.3.0",
71+
"karma-chrome-launcher": "^2.0.0",
7272
"karma-coverage": "^1.0.0",
7373
"karma-jasmine": "^1.0.2",
7474
"karma-mocha-reporter": "^2.0.3",
7575
"karma-phantomjs-launcher": "^1.0.0",
76-
"karma-remap-istanbul": "0.1.1",
76+
"karma-remap-istanbul": "0.2.1",
7777
"karma-sourcemap-loader": "^0.3.7",
78-
"karma-webpack": "1.7.0",
78+
"karma-webpack": "1.8.0",
7979
"node-sass": "^3.4.2",
8080
"null-loader": "0.1.1",
8181
"phantomjs-prebuilt": "^2.1.4",
82-
"postcss-loader": "^0.9.1",
82+
"postcss-loader": "^0.13.0",
8383
"protractor": "^3.1.1",
8484
"raw-loader": "0.5.1",
8585
"remap-istanbul": "^0.6.4",
8686
"rimraf": "^2.5.1",
8787
"sass-loader": "^4.0.0",
8888
"shelljs": "^0.7.0",
8989
"style-loader": "^0.13.0",
90-
"systemjs": "0.19.38",
91-
"systemjs-builder": "0.15.31",
9290
"ts-helpers": "^1.1.1",
9391
"tslint": "^3.4.0",
9492
"tslint-loader": "^2.1.0",
9593
"typedoc": "^0.4.4",
9694
"typescript": "2.0.2",
9795
"url-loader": "^0.5.6",
98-
"webpack": "^1.12.13",
96+
"webpack": "^2.1.0-beta.25",
9997
"webpack-dashboard": "^0.1.8",
100-
"webpack-dev-server": "^1.14.1"
98+
"webpack-dev-server": "2.1.0-beta.5"
10199
}
102100
}

src/vendor.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import '@angular/http';
77
import '@angular/router';
88

99
import 'rxjs';
10+
import '@angularclass/hmr';
1011

1112
// Other vendors for example jQuery, Lodash or Bootstrap
1213
// You can import js, ts, css, sass, ...

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"module": "commonjs",
55
"emitDecoratorMetadata": true,
66
"experimentalDecorators": true,
7-
"declaration": true,
8-
"sourceMap": true
7+
"sourceMap": true,
8+
"noEmitHelpers": true
99
},
1010
"compileOnSave": false,
1111
"buildOnSave": false,

tslint.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"no-shadowed-variable": true,
4848
"no-string-literal": false,
4949
"no-switch-case-fall-through": true,
50-
"no-trailing-whitespace": true,
50+
"no-trailing-whitespace": false,
5151
"no-unused-expression": true,
5252
"no-unused-variable": true,
5353
"no-unreachable": true,
@@ -56,7 +56,6 @@
5656
"object-literal-sort-keys": false,
5757
"one-line": [
5858
true,
59-
"check-open-brace",
6059
"check-catch",
6160
"check-else",
6261
"check-whitespace"

webpack.config.js

+63-54
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ module.exports = function makeWebpackConfig() {
3535
*/
3636
if (isProd) {
3737
config.devtool = 'source-map';
38-
}
38+
}
3939
else if (isTest) {
4040
config.devtool = 'inline-source-map';
4141
}
4242
else {
4343
config.devtool = 'eval-source-map';
4444
}
4545

46-
// add debug messages
47-
config.debug = !isProd || !isTest;
48-
4946
/**
5047
* Entry
5148
* Reference: http://webpack.github.io/docs/configuration.html#entry
@@ -72,21 +69,15 @@ module.exports = function makeWebpackConfig() {
7269
* Reference: http://webpack.github.io/docs/configuration.html#resolve
7370
*/
7471
config.resolve = {
75-
cache: !isTest,
76-
root: root(),
7772
// only discover files that have those extensions
78-
extensions: ['', '.ts', '.js', '.json', '.css', '.scss', '.html'],
79-
alias: {
80-
'app': 'src/app',
81-
'common': 'src/common'
82-
}
73+
extensions: ['.ts', '.js', '.json', '.css', '.scss', '.html'],
8374
};
8475

8576
var atlOptions = '';
8677
if (isTest && !isTestWatch) {
8778
// awesome-typescript-loader needs to output inlineSourceMap for code coverage to work with source maps.
8879
atlOptions = 'inlineSourceMap=true&sourceMap=false';
89-
}
80+
}
9081

9182
/**
9283
* Loaders
@@ -95,8 +86,7 @@ module.exports = function makeWebpackConfig() {
9586
* This handles most of the magic responsible for converting modules
9687
*/
9788
config.module = {
98-
preLoaders: isTest ? [] : [{test: /\.ts$/, loader: 'tslint'}],
99-
loaders: [
89+
rules: [
10090
// Support for .ts files.
10191
{
10292
test: /\.ts$/,
@@ -119,7 +109,7 @@ module.exports = function makeWebpackConfig() {
119109
{
120110
test: /\.css$/,
121111
exclude: root('src', 'app'),
122-
loader: isTest ? 'null' : ExtractTextPlugin.extract('style', 'css?sourceMap!postcss')
112+
loader: isTest ? 'null' : ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css', 'postcss']})
123113
},
124114
// all css required in src/app files will be merged in js files
125115
{test: /\.css$/, include: root('src', 'app'), loader: 'raw!postcss'},
@@ -130,28 +120,37 @@ module.exports = function makeWebpackConfig() {
130120
{
131121
test: /\.scss$/,
132122
exclude: root('src', 'app'),
133-
loader: isTest ? 'null' : ExtractTextPlugin.extract('style', 'css?sourceMap!postcss!sass')
123+
loader: isTest ? 'null' : ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: ['css', 'postcss', 'sass']})
134124
},
135125
// all css required in src/app files will be merged in js files
136126
{test: /\.scss$/, exclude: root('src', 'style'), loader: 'raw!postcss!sass'},
137127

138128
// support for .html as raw text
139129
// todo: change the loader to something that adds a hash to images
140130
{test: /\.html$/, loader: 'raw', exclude: root('src', 'public')}
141-
],
142-
postLoaders: []
131+
]
143132
};
144133

145134
if (isTest && !isTestWatch) {
146135
// instrument only testing sources with Istanbul, covers ts files
147-
config.module.postLoaders.push({
136+
config.module.rules.push({
148137
test: /\.ts$/,
138+
enforce: 'post',
149139
include: path.resolve('src'),
150140
loader: 'istanbul-instrumenter-loader',
151141
exclude: [/\.spec\.ts$/, /\.e2e\.ts$/, /node_modules/]
152142
});
153143
}
154144

145+
if (!isTest || !isTestWatch) {
146+
// tslint support
147+
config.module.rules.push({
148+
test: /\.ts$/,
149+
enforce: 'pre',
150+
loader: 'tslint'
151+
});
152+
}
153+
155154
/**
156155
* Plugins
157156
* Reference: http://webpack.github.io/docs/configuration.html#plugins
@@ -165,14 +164,53 @@ module.exports = function makeWebpackConfig() {
165164
'process.env': {
166165
ENV: JSON.stringify(ENV)
167166
}
167+
}),
168+
169+
// Workaround needed for angular 2 angular/angular#11580
170+
new webpack.ContextReplacementPlugin(
171+
// The (\\|\/) piece accounts for path separators in *nix and Windows
172+
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
173+
root('./src') // location of your src
174+
),
175+
176+
// Tslint configuration for webpack 2
177+
new webpack.LoaderOptionsPlugin({
178+
options: {
179+
/**
180+
* Apply the tslint loader as pre/postLoader
181+
* Reference: https://github.com/wbuchwalter/tslint-loader
182+
*/
183+
tslint: {
184+
emitErrors: false,
185+
failOnHint: false
186+
},
187+
/**
188+
* Sass
189+
* Reference: https://github.com/jtangelder/sass-loader
190+
* Transforms .scss files to .css
191+
*/
192+
sassLoader: {
193+
//includePaths: [path.resolve(__dirname, "node_modules/foundation-sites/scss")]
194+
},
195+
/**
196+
* PostCSS
197+
* Reference: https://github.com/postcss/autoprefixer-core
198+
* Add vendor prefixes to your css
199+
*/
200+
postcss: [
201+
autoprefixer({
202+
browsers: ['last 2 version']
203+
})
204+
]
205+
}
168206
})
169207
];
170208

171209
if (!isTest && !isProd) {
172210
config.plugins.push(new DashboardPlugin());
173211
}
174212

175-
if (!isTest) {
213+
if (!isTest && !isTestWatch) {
176214
config.plugins.push(
177215
new ForkCheckerPlugin(),
178216

@@ -193,7 +231,7 @@ module.exports = function makeWebpackConfig() {
193231
// Extract css files
194232
// Reference: https://github.com/webpack/extract-text-webpack-plugin
195233
// Disabled when in test mode or not in build mode
196-
new ExtractTextPlugin('css/[name].[hash].css', {disable: !isProd})
234+
new ExtractTextPlugin({filename: 'css/[name].[hash].css', disable: !isProd})
197235
);
198236
}
199237

@@ -204,13 +242,13 @@ module.exports = function makeWebpackConfig() {
204242
// Only emit files when there are no errors
205243
new webpack.NoErrorsPlugin(),
206244

207-
// Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
208-
// Dedupe modules in the output
209-
new webpack.optimize.DedupePlugin(),
245+
// // Reference: http://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
246+
// // Dedupe modules in the output
247+
// new webpack.optimize.DedupePlugin(),
210248

211249
// Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
212250
// Minify all javascript, switch loaders to minimizing mode
213-
new webpack.optimize.UglifyJsPlugin({mangle: { keep_fnames: true }}),
251+
new webpack.optimize.UglifyJsPlugin({sourceMap: true, mangle: { keep_fnames: true }}),
214252

215253
// Copy assets from the public folder
216254
// Reference: https://github.com/kevlened/copy-webpack-plugin
@@ -220,35 +258,6 @@ module.exports = function makeWebpackConfig() {
220258
);
221259
}
222260

223-
/**
224-
* PostCSS
225-
* Reference: https://github.com/postcss/autoprefixer-core
226-
* Add vendor prefixes to your css
227-
*/
228-
config.postcss = [
229-
autoprefixer({
230-
browsers: ['last 2 version']
231-
})
232-
];
233-
234-
/**
235-
* Sass
236-
* Reference: https://github.com/jtangelder/sass-loader
237-
* Transforms .scss files to .css
238-
*/
239-
config.sassLoader = {
240-
//includePaths: [path.resolve(__dirname, "node_modules/foundation-sites/scss")]
241-
};
242-
243-
/**
244-
* Apply the tslint loader as pre/postLoader
245-
* Reference: https://github.com/wbuchwalter/tslint-loader
246-
*/
247-
config.tslint = {
248-
emitErrors: false,
249-
failOnHint: false
250-
};
251-
252261
/**
253262
* Dev server configuration
254263
* Reference: http://webpack.github.io/docs/configuration.html#devserver

0 commit comments

Comments
 (0)