feat(dependencies): update ng-router-loader to 2.1.0

This commit is contained in:
Alexander Zhukov 2017-01-27 13:24:47 +03:00
parent 33f0fbb457
commit 1ae084afc0
5 changed files with 160 additions and 74 deletions

View file

@ -90,26 +90,46 @@ module.exports = function (options) {
module: {
rules: [
/*
* Typescript loader support for .ts and Angular 2 async routes via .async.ts
* Replace templateUrl and stylesUrl with require()
* Typescript loader support for .ts
*
* Component Template/Style integration using `angular2-template-loader`
* Angular 2 lazy loading (async routes) via `ng-router-loader`
*
* `ng-router-loader` expects vanilla JavaScript code, not TypeScript code. This is why the
* order of the loader matter.
*
* See: https://github.com/s-panferov/awesome-typescript-loader
* See: https://github.com/TheLarkInn/angular2-template-loader
* See: https://github.com/shlomiassaf/ng-router-loader
*/
{
test: /\.ts$/,
use: [
'@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd,
'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}',
'angular2-template-loader',
{
loader: '@angularclass/hmr-loader',
options: {
pretty: !isProd,
prod: isProd
}
},
{ // MAKE SURE TO CHAIN VANILLA JS CODE, I.E. TS COMPILATION OUTPUT.
loader: 'ng-router-loader',
options: {
loader: 'async-system',
loader: 'async-import',
genDir: 'compiled',
aot: AOT
}
},
{
loader: 'awesome-typescript-loader',
options: {
configFileName: 'tsconfig.webpack.json'
}
},
{
loader: 'angular2-template-loader'
}
],
exclude: [/\.(spec|e2e)\.ts$/]
@ -220,7 +240,7 @@ module.exports = function (options) {
new CommonsChunkPlugin({
name: 'vendor',
chunks: ['main'],
minChunks: module => /node_modules\//.test(module.resource)
minChunks: module => /node_modules/.test(module.resource)
}),
// Specify the correct order the scripts will be injected in
new CommonsChunkPlugin({

View file

@ -13,9 +13,7 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
const WebpackMd5Hash = require('webpack-md5-hash');
const V8LazyParseWebpackPlugin = require('v8-lazy-parse-webpack-plugin');
const OptimizeJsPlugin = require('optimize-js-plugin');
/**
* Webpack Constants
*/
@ -88,12 +86,15 @@ module.exports = function (env) {
plugins: [
/**
* Plugin: WebpackMd5Hash
* Description: Plugin to replace a standard webpack chunkhash with md5.
* Webpack plugin to optimize a JavaScript file for faster initial load
* by wrapping eagerly-invoked functions.
*
* See: https://www.npmjs.com/package/webpack-md5-hash
* See: https://github.com/vigneshshanmugam/optimize-js-plugin
*/
new WebpackMd5Hash(),
new OptimizeJsPlugin({
sourceMap: false
}),
/**
* Plugin: DedupePlugin