Skip to content

Commit 30dfe5e

Browse files
In Angular2Spa webpack config, use "--env.prod" arg to trigger prod builds instead of ASPNETCORE_ENVIRONMENT env var. This is to guarantee production mode when publishing.
1 parent 4696632 commit 30dfe5e

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

‎templates/Angular2Spa/project.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
"scripts":{
6868
"prepublish": [
6969
"npm install",
70-
"node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
71-
"node node_modules/webpack/bin/webpack.js"
70+
"node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod",
71+
"node node_modules/webpack/bin/webpack.js --env.prod"
7272
],
7373
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
7474
},

‎templates/Angular2Spa/webpack.config.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
varisDevBuild=process.argv.indexOf('--env.prod')<0;
12
varpath=require('path');
23
varwebpack=require('webpack');
34

4-
varisDevBuild=process.env.ASPNETCORE_ENVIRONMENT==='Development';
5-
65
module.exports={
76
devtool: isDevBuild ? 'inline-source-map' : null,
87
resolve: {extensions: ['','.js','.ts']},

‎templates/Angular2Spa/webpack.config.vendor.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
varisDevBuild=process.argv.indexOf('--env.prod')<0;
12
varpath=require('path');
23
varwebpack=require('webpack');
34
varExtractTextPlugin=require('extract-text-webpack-plugin');
45
varextractCSS=newExtractTextPlugin('vendor.css');
5-
varisDevelopment=process.env.ASPNETCORE_ENVIRONMENT==='Development';
66

77
module.exports={
88
resolve: {
@@ -47,7 +47,7 @@ module.exports ={
4747
path: path.join(__dirname,'wwwroot','dist','[name]-manifest.json'),
4848
name: '[name]_[hash]'
4949
})
50-
].concat(isDevelopment ? [] : [
50+
].concat(isDevBuild ? [] : [
5151
newwebpack.optimize.UglifyJsPlugin({compress: {warnings: false}})
5252
])
5353
};

0 commit comments

Comments
(0)