Skip to content

chore(npm): updated webpack version and config cleanup #2237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7b7d31b
chore(npm): updated webpack version and reworked configs for breaking…
TheLarkInn Sep 20, 2016
6ead8bd
fix: swapped enforce rules by accident, fix this
TheLarkInn Sep 20, 2016
8e63c8d
fix: fix version, as well as convert loaders to rules for future api …
TheLarkInn Sep 20, 2016
ab8faa8
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 20, 2016
6a88447
chore: update webpack to beta.24
TheLarkInn Sep 21, 2016
fe07e37
chore(npm): updated webpack to beta.25
TheLarkInn Sep 22, 2016
a1771ae
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 22, 2016
fb8ef37
chore(lint): remove rogue double quote
TheLarkInn Sep 23, 2016
c08aca7
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 26, 2016
13c3c0f
Added augmented module typings for webpack v2 supporting webpack.Load…
TheLarkInn Sep 26, 2016
eb8017e
chore(lint): linting chores spaces, return lines, semis
TheLarkInn Sep 26, 2016
c491bf0
Merge branch 'feature/webpack_vesion_23_with_breaking_changes' of htt…
TheLarkInn Sep 26, 2016
0e74c50
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 27, 2016
f44c869
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 27, 2016
22e2c27
chore(npm): updated both package.jsons cause who forgets to do that
TheLarkInn Sep 27, 2016
f6963a1
Merge branch 'feature/webpack_vesion_23_with_breaking_changes' of htt…
TheLarkInn Sep 27, 2016
24d9a16
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 27, 2016
5877fb5
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 27, 2016
701a57c
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 27, 2016
b5326b9
Merge remote-tracking branch 'origin/master' into feature/webpack_ves…
TheLarkInn Sep 28, 2016
63801b4
Merge branch 'master' into feature/webpack_vesion_23_with_breaking_ch…
TheLarkInn Sep 28, 2016
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"typedoc": "^0.4.2",
"typescript": "2.0.2",
"url-loader": "^0.5.7",
"webpack": "2.1.0-beta.22",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.3",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "^0.14.0",
Expand Down
14 changes: 5 additions & 9 deletions packages/angular-cli/models/webpack-build-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ export function getWebpackCommonConfig(
return {
devtool: 'source-map',
resolve: {
extensions: ['', '.ts', '.js'],
root: appRoot
extensions: ['.ts', '.js']
},
context: path.resolve(__dirname, './'),
entry: entry,
Expand All @@ -43,18 +42,15 @@ export function getWebpackCommonConfig(
filename: '[name].bundle.js'
},
module: {
preLoaders: [
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
exclude: [
/node_modules/
]
}
],
loaders: [
// TypeScript loaders are separated into webpack-build-typescript.

},
// in main, load css as raw text
       {
exclude: styles,
Expand Down Expand Up @@ -140,7 +136,7 @@ export function getWebpackCommonConfig(
],
node: {
fs: 'empty',
global: 'window',
global: true,
crypto: 'empty',
module: false,
clearImmediate: false,
Expand Down
30 changes: 24 additions & 6 deletions packages/angular-cli/models/webpack-build-development.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
const path = require('path');

import * as webpack from 'webpack';

declare module 'webpack' {
export interface LoaderOptionsPlugin {}
export interface LoaderOptionsPluginStatic {
new (optionsObject: any): LoaderOptionsPlugin;
}
interface Webpack {
LoaderOptionsPlugin: LoaderOptionsPluginStatic;
}
};

export const getWebpackDevConfigPartial = function(projectRoot: string, appConfig: any) {
return {
devtool: 'source-map',
Expand All @@ -9,14 +21,20 @@ export const getWebpackDevConfigPartial = function(projectRoot: string, appConfi
sourceMapFilename: '[name].map',
chunkFilename: '[id].chunk.js'
},
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: path.resolve(projectRoot, appConfig.root)
},
plugins: [
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: path.resolve(projectRoot, appConfig.root)
},
}
})
],
node: {
fs: 'empty',
global: 'window',
global: true,
crypto: 'empty',
process: true,
module: false,
Expand Down
39 changes: 21 additions & 18 deletions packages/angular-cli/models/webpack-build-production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as webpack from 'webpack';

export const getWebpackProdConfigPartial = function(projectRoot: string, appConfig: any) {
return {
debug: false,
devtool: 'source-map',
output: {
path: path.resolve(projectRoot, appConfig.outDir),
Expand All @@ -25,27 +24,31 @@ export const getWebpackProdConfigPartial = function(projectRoot: string, appConf
test: /\.js$|\.html$/,
threshold: 10240,
minRatio: 0.8
}),
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: true,
failOnHint: true,
resourcePath: path.resolve(projectRoot, appConfig.root)
},
htmlLoader: {
minimize: true,
removeAttributeQuotes: false,
caseSensitive: true,
customAttrSurround: [
[/#/, /(?:)/],
[/\*/, /(?:)/],
[/\[?\(?/, /(?:)/]
],
customAttrAssign: [/\)?\]?=/]
}
}
})
],
tslint: {
emitErrors: true,
failOnHint: true,
resourcePath: path.resolve(projectRoot, appConfig.root)
},
htmlLoader: {
minimize: true,
removeAttributeQuotes: false,
caseSensitive: true,
customAttrSurround: [
[/#/, /(?:)/],
[/\*/, /(?:)/],
[/\[?\(?/, /(?:)/]
],
customAttrAssign: [/\)?\]?=/]
},
node: {
fs: 'empty',
global: 'window',
global: true,
crypto: 'empty',
process: true,
module: false,
Expand Down
48 changes: 25 additions & 23 deletions packages/angular-cli/models/webpack-build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) {
devtool: 'inline-source-map',
context: path.resolve(__dirname, './'),
resolve: {
extensions: ['', '.ts', '.js'],
root: appRoot
extensions: ['.ts', '.js']
},
entry: {
test: path.resolve(appRoot, appConfig.test)
Expand All @@ -22,24 +21,24 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) {
filename: '[name].bundle.js'
},
module: {
preLoaders: [
rules: [
{
test: /\.ts$/,
enforce: 'pre',
loader: 'tslint-loader',
exclude: [
path.resolve(projectRoot, 'node_modules')
]
},
{
test: /\.js$/,
enforce: 'pre',
loader: 'source-map-loader',
exclude: [
path.resolve(projectRoot, 'node_modules/rxjs'),
path.resolve(projectRoot, 'node_modules/@angular')
]
}
],
loaders: [
},
{
test: /\.ts$/,
loaders: [
Expand All @@ -58,23 +57,22 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) {
],
exclude: [/\.e2e\.ts$/]
},
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.css$/, loaders: ['raw-loader', 'postcss-loader'] },
{ test: /\.styl$/, loaders: ['raw-loader', 'postcss-loader', 'stylus-loader'] },
{ test: /\.less$/, loaders: ['raw-loader', 'postcss-loader', 'less-loader'] },
{ test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] },
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' },
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] }
],
postLoaders: [
{
test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader',
enforce: 'post',
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
],
query: { 'force-sourcemap': true }
}
},
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.css$/, loaders: ['raw-loader', 'postcss-loader'] },
{ test: /\.styl$/, loaders: ['raw-loader', 'postcss-loader', 'stylus-loader'] },
{ test: /\.less$/, loaders: ['raw-loader', 'postcss-loader', 'less-loader'] },
{ test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] },
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' },
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] }
]
},
plugins: [
Expand All @@ -89,16 +87,20 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) {
new RegExp(path.resolve(appRoot, appConfig.environments['source'])
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')),
path.resolve(appRoot, appConfig.environments[environment])
)
),
new webpack.LoaderOptionsPlugin({
options: {
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: `./${appConfig.root}`
}
}
})
],
tslint: {
emitErrors: false,
failOnHint: false,
resourcePath: `./${appConfig.root}`
},
node: {
fs: 'empty',
global: 'window',
global: true,
process: false,
crypto: 'empty',
module: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/angular-cli/models/webpack-build-typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const getWebpackNonAotConfigPartial = function(projectRoot: string, appCo

return {
module: {
loaders: [
rules: [
{
test: /\.ts$/,
loaders: [{
Expand All @@ -43,7 +43,7 @@ export const getWebpackNonAotConfigPartial = function(projectRoot: string, appCo
export const getWebpackAotConfigPartial = function(projectRoot: string, appConfig: any) {
return {
module: {
loaders: [
rules: [
{
test: /\.ts$/,
loader: webpackLoader,
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"typedoc": "^0.4.2",
"typescript": "2.0.2",
"url-loader": "^0.5.7",
"webpack": "2.1.0-beta.22",
"webpack": "2.1.0-beta.25",
"webpack-dev-server": "2.1.0-beta.3",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "^0.14.0",
Expand Down