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 1 commit
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,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.23",
Copy link

Choose a reason for hiding this comment

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

better fix the version

Copy link
Member Author

Choose a reason for hiding this comment

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

Was working on that as we speak lol!

"webpack-dev-server": "2.1.0-beta.3",
"webpack-md5-hash": "0.0.5",
"webpack-merge": "^0.14.0",
Expand Down Expand Up @@ -157,6 +157,7 @@
"tree-kill": "^1.0.0",
"ts-node": "^1.3.0",
"tslint": "^3.11.0",
"walk-sync": "^0.2.6"
"walk-sync": "^0.2.6",
"webpack": "^2.1.0-beta.23"
Copy link

Choose a reason for hiding this comment

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

why dependency and devDependency

Copy link
Member Author

Choose a reason for hiding this comment

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

The angular-cli creates a new project, and the repo itself is a dev-dep of the generated project. So in the scope of the angular-cli, webpack is a dependency, not a dev dependency.

Copy link
Member Author

Choose a reason for hiding this comment

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

A new project may look like this.

screen shot 2016-09-20 at 10 36 30 am

}
}
12 changes: 5 additions & 7 deletions packages/angular-cli/models/webpack-build-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,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 @@ -46,16 +45,15 @@ export function getWebpackCommonConfig(
filename: '[name].bundle.js'
},
module: {
preLoaders: [
loaders: [
{
enforce: "left",
Copy link

Choose a reason for hiding this comment

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

preLoader -> enforce: "right"

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks I updated this

test: /\.js$/,
loader: 'source-map-loader',
exclude: [
/node_modules/
]
}
],
loaders: [
},
{
test: /\.ts$/,
loaders: [
Expand Down Expand Up @@ -159,7 +157,7 @@ export function getWebpackCommonConfig(
],
node: {
fs: 'empty',
global: 'window',
global: true,
crypto: 'empty',
module: false,
clearImmediate: false,
Expand Down
19 changes: 13 additions & 6 deletions packages/angular-cli/models/webpack-build-development.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path');
import * as webpack from 'webpack';

export const getWebpackDevConfigPartial = function(projectRoot: string, appConfig: any) {
return {
Expand All @@ -9,14 +10,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: [
loaders: [
{
test: /\.ts$/,
enforce: 'left',
loader: 'tslint-loader',
exclude: [
path.resolve(projectRoot, 'node_modules')
]
},
{
test: /\.js$/,
enforce: 'left',
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: 'right',
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