Skip to content
This repository has been archived by the owner on Aug 1, 2020. It is now read-only.

Commit

Permalink
feat: upgrade to webpack 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
about-code committed Mar 3, 2018
1 parent d2b2b2e commit bccf523
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 108 deletions.
6 changes: 3 additions & 3 deletions generators/project-app/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

## Building and bundling an app from packages

- Build and serve production build: `npm start`
- Build and serve development build: `npm run debug`
- Build production bundle: `npm run build`
- Build optimized production bundle: `npm run build`
- Build and serve optimized production build: `npm run build-serve`
- Build and serve debuggable development build: `npm start`

### Building packages for reuse

Expand Down
3 changes: 1 addition & 2 deletions generators/project-app/template/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module.exports = {
extractSass
,new CleanWebpackPlugin([outputPath])
,new AngularCompilerPlugin({
tsConfigPath: './tsconfig-aot.json',
tsConfigPath: './tsconfig.json',
})
// Workaround for angular/angular#11580
,new webpack.ContextReplacementPlugin(
Expand All @@ -90,6 +90,5 @@ module.exports = {
minimize: false // workaround for ng2
}
})
,new webpack.NoEmitOnErrorsPlugin(),
]
};
6 changes: 1 addition & 5 deletions generators/project-app/template/config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';
////////////////////////////////////////////////////////////////////////////////
module.exports = webpackMerge(commonConfig, {
devtool: 'cheap-module-eval-source-map',
watch: true,
mode: 'development',
entry: {
'app': './src/app-jit.ts'
},
plugins: [
new webpack.DefinePlugin({
'process.env': { 'ENV': JSON.stringify(ENV) }
}),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills', 'theme']
})
]
});
10 changes: 1 addition & 9 deletions generators/project-app/template/config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin');
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
////////////////////////////////////////////////////////////////////////////////
module.exports = webpackMerge(commonConfig, {
devtool: 'source-map',
mode: 'production',
entry: {
'app': './src/app-aot.ts'
},
plugins: [
new webpack.DefinePlugin({
'process.env': { 'ENV': JSON.stringify(ENV) }
}),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills', 'theme']
}),
new webpack.optimize.UglifyJsPlugin({ // https://github.com/angular/angular/issues/10618
mangle: {
keep_fnames: true
}
})
]
});
3 changes: 1 addition & 2 deletions generators/project-app/template/config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var commonConfig = require('./webpack.common.js');
const ENV = process.env.NODE_ENV = process.env.ENV = 'development';
////////////////////////////////////////////////////////////////////////////////
module.exports = {
devtool: 'cheap-module-eval-source-map',
watch: true,
mode: 'development',
plugins: []
};
33 changes: 17 additions & 16 deletions generators/project-app/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@
"devDependencies": {
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@ngtools/webpack": "^1.10.1",
"@types/jasmine": "~2.8.4",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~9.3.0",
"@ngtools/webpack": "^1.9.4",
"clean-webpack-plugin": "^0.1.17",
"codelyzer": "~4.0.2",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^1.1.5",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^3.0.4",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~2.0.0",
Expand All @@ -33,40 +39,35 @@
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.2.2",
"tslint": "~5.7.0",
"typescript": "~2.7.1",
"clean-webpack-plugin": "^0.1.17",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.5",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1",
"ng-packagr": "~2.0.0",
"karma-webpack": "~2.0.5",
"lerna": "^2.4.0",
"ng-packagr": "~2.0.0",
"node-sass": "^4.5.3",
"protractor": "~5.2.2",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.6",
"standard-version": "^4.2.0",
"style-loader": "^0.19.0",
"ts-loader": "^3.1.1",
"ts-node": "~4.1.0",
"webpack": "~3.10.0",
"webpack-dev-server": "~2.7.1",
"tslint": "~5.7.0",
"typescript": "^2.7.2",
"webpack": "^4.0.1",
"webpack-cli": "^2.0.10",
"webpack-dev-server": "^3.1.0",
"webpack-merge": "^4.1.0"
},
"main": "index.js",
"scripts": {
"build": "webpack --config ./config/webpack.prod.js",
"build-pkg": "node ./scripts/build-packages.js",
"release": "standard-version",
"build-serve": "webpack-dev-server --config ./config/webpack.prod.js --watch --progress",
"clean": "node ./scripts/clean.js",
"develop": "webpack-dev-server --config ./config/webpack.dev.js --progress",
"lerna": "lerna",
"linter-fix": "tslint --fix --project='./tslint.json' --type-check",
"release": "standard-version",
"selenium": "webdriver-manager start",
"start": "webpack-dev-server --config ./config/webpack.prod.js --watch --progress",
"start": "webpack-dev-server --config ./config/webpack.dev.js --progress",
"test": "./node_modules/karma/bin/karma start ./config/karma.conf.js",
"test-e2e": "protractor ./config/protractor.js",
"webdriver-manager": "webdriver-manager"
Expand Down
22 changes: 0 additions & 22 deletions generators/project-app/template/tsconfig-aot.json

This file was deleted.

66 changes: 17 additions & 49 deletions generators/project-app/template/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,22 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2015", "dom"], /* Specify library files to be included in the compilation: */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
"sourceMap": false, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": false, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": ".", /* Base directory to resolve non-absolute module names. */
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"declaration": false,
"noImplicitAny": false,
"removeComments": true,
"experimentalDecorators": true,
"baseUrl": ".",
"lib": ["es2015", "dom"],
"paths": {
"<%= pkg_scope %>/*": ["packages/<%= pkg_scope %>/*", "node_modules/<%= pkg_scope %>/*"]
}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"<%= pkg_scope %>/*": ["./node_modules/<%= pkg_scope %>/*", "./packages/<%= pkg_scope %>/*"]
}
},
"exclude": [
"node_modules"
]
"angularCompilerOptions": {
"entryModule": "./packages/<%= pkg_fullname %>/src/AppModule#AppModule",
"skipMetadataEmit": true
}
}

0 comments on commit bccf523

Please sign in to comment.