Skip to content

Commit

Permalink
misc: upgrade to ngc-webpack 1.1.0 (#1344)
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiassaf authored and joshwiens committed Jan 6, 2017
1 parent cb49bb5 commit 5d85631
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Empty file added config/resource-override.js
Empty file.
8 changes: 8 additions & 0 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const HtmlElementsPlugin = require('./html-elements-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const ngcWebpack = require('ngc-webpack');

/*
* Webpack Constants
Expand Down Expand Up @@ -323,6 +324,13 @@ module.exports = function (options) {
/facade(\\|\/)math/,
helpers.root('node_modules/@angular/core/src/facade/math.js')
),

new ngcWebpack.NgcWebpackPlugin({
disabled: !AOT,
tsConfig: helpers.root('tsconfig.webpack.json'),
resourceOverride: helpers.root('config/resource-override.js')
})

],

/*
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"homepage": "https://github.com/angularclass/angular2-webpack-starter",
"license": "MIT",
"scripts": {
"build:aot:prod": "npm run clean:dist && npm run clean:aot && npm run ngc -- --webpack config/webpack.prod.js && webpack --config config/webpack.prod.js --progress --profile --bail",
"build:aot:prod": "npm run clean:dist && npm run clean:aot && webpack --config config/webpack.prod.js --progress --profile --bail",
"build:aot": "npm run build:aot:prod",
"build:dev": "npm run clean:dist && webpack --config config/webpack.dev.js --progress --profile",
"build:docker": "npm run build:prod && docker build -t angular2-webpack-start:latest .",
Expand All @@ -36,7 +36,6 @@
"github-deploy:prod": "webpack --config config/webpack.github-deploy.js --progress --profile --env.githubProd",
"github-deploy": "npm run github-deploy:dev",
"lint": "npm run tslint \"src/**/*.ts\"",
"ngc": "./node_modules/.bin/ngc-w -p tsconfig.webpack.json",
"postversion": "git push && git push --tags",
"prebuild:dev": "npm run clean:dist",
"prebuild:prod": "npm run clean:dist",
Expand Down Expand Up @@ -123,7 +122,7 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "1.8.1",
"ng-router-loader": "^1.0.2",
"ngc-webpack": "^1.0.2",
"ngc-webpack": "1.1.0",
"node-sass": "^4.1.1",
"npm-run-all": "^4.0.0",
"parse5": "^3.0.1",
Expand Down

3 comments on commit 5d85631

@adrhc
Copy link

@adrhc adrhc commented on 5d85631 Jan 15, 2017

Choose a reason for hiding this comment

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

It breaks images in *.html, e.g.:

<img src="../../images/fullscreen-back2.jpg">
The href is generated fine but the image is not copied to the "dist" directory.

Keeping only the ngc-webpack version change everything is back to normal.

@shlomiassaf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the resourceOverride feature is used to replace the html and css imports in @Component metadata with empty js files.

The reason to do so is because it is redundant data, it is not being used at runtime anyway since the AOT compiler creates a separate version of it.

If you have a complex setup and you reference images from within a component css then you might run into issues.

I havent checked that deeply, but you can remove this feature for now and you won't have issues.

@shlomiassaf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Track shlomiassaf/ngc-webpack#4 for a version with a fix.

Please sign in to comment.