Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Bump angular to 4+, update year to 2017, HTML output for build via webpack #158

Merged
merged 4 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "A simple starter Angular2 project",
"scripts": {
"build": "webpack --progress",
"build": "rimraf dist && webpack --progress",
"watch": "npm run build -- --watch",
"server": "webpack-dev-server --inline --progress --port 3000 --content-base src",
"start": "npm run server"
Expand All @@ -14,37 +14,38 @@
],
"license": "MIT",
"dependencies": {
"@angular/common": "~2.2.1",
"@angular/compiler": "~2.2.1",
"@angular/compiler-cli": "~2.2.1",
"@angular/core": "~2.2.1",
"@angular/forms": "~2.2.1",
"@angular/http": "~2.2.1",
"@angular/platform-browser": "~2.2.1",
"@angular/platform-browser-dynamic": "~2.2.1",
"@angular/platform-server": "~2.2.1",
"@angular/router": "~3.2.1",
"@angular/upgrade": "~2.2.1",
"angular2-in-memory-web-api": "0.0.21",
"bootstrap": "^3.3.7",
"@angular/common": "~4.0.1",
"@angular/compiler": "~4.0.1",
"@angular/compiler-cli": "~4.0.1",
"@angular/core": "~4.0.1",
"@angular/forms": "~4.0.1",
"@angular/http": "~4.0.1",
"@angular/platform-browser": "~4.0.1",
"@angular/platform-browser-dynamic": "~4.0.1",
"@angular/platform-server": "~4.0.1",
"@angular/router": "~4.0.1",
"@angular/upgrade": "~4.0.1",
"angular-in-memory-web-api": "^0.3.1",
"core-js": "^2.4.1",
"ie-shim": "^0.1.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.12",
"zone.js": "~0.6.26"
"reflect-metadata": "^0.1.9",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@types/node": "^6.0.48",
"@types/node": "^7.0.12",
"angular2-router-loader": "^0.3.4",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^2.2.4",
"css-loader": "^0.25.0",
"awesome-typescript-loader": "^3.1.2",
"css-loader": "^0.26.0",
"html-webpack-plugin": "^2.28.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.5.4",
"to-string-loader": "^1.1.4",
"typescript": "~2.0.10",
"webpack": "2.1.0-beta.27",
"webpack-dev-server": "2.1.0-beta.11",
"webpack-merge": "^0.15.0"
"typescript": "~2.2.0",
"webpack": "^2.4.1",
"webpack-dev-server": "2.4.2",
"webpack-merge": "^4.1.0"
},
"keywords": [
"Angular2",
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ <h3>


<footer>
© 2016
© 2017
</footer>
2 changes: 0 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@
Loading...
</app>

<script async src="/main.bundle.js"></script>

</body>
</html>
10 changes: 8 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var webpack = require('webpack');
var path = require('path');
var webpackMerge = require('webpack-merge');
var HtmlWebpackPlugin = require('html-webpack-plugin');

// Webpack Config
var webpackConfig = {
Expand All @@ -16,12 +17,17 @@ var webpackConfig = {
plugins: [
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)src(\\|\/)linker/,
path.resolve(__dirname, './src'),
/angular(\\|\/)core(\\|\/)@angular/,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why you want to change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ContextReplacementPlugin has to do with silencing some warnings that webpack outputs. See this issue: angular/angular#11580. The behavior between Angular 2.x and 4.x changed a little, and so with the update to 4.x we also want to update the webpack "workaround". If you are staying on Angular 2.x, you wouldn't want to make this change.

This specific comment in the issue addresses the updated behavior and updated webpack config: angular/angular#11580 (comment)

path.resolve(__dirname, '../src'),
{
// your Angular Async Route paths relative to this root directory
}
),

new HtmlWebpackPlugin({
template: 'src/index.html'
}),

],

module: {
Expand Down
Loading