Activate Angular production mode on master branch.
This commit is contained in:
parent
38ff12070e
commit
5ef1848db2
4 changed files with 55 additions and 32 deletions
|
@ -8,12 +8,28 @@ build_job:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
- npm run build
|
- npm run build-dev
|
||||||
- npm run test
|
- npm run test
|
||||||
tags:
|
tags:
|
||||||
- javascript
|
- javascript
|
||||||
except:
|
except:
|
||||||
- tags
|
- tags
|
||||||
|
- master
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- dist
|
||||||
|
expire_in: 30 min
|
||||||
|
|
||||||
|
build_job_production:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- npm install
|
||||||
|
- npm run build
|
||||||
|
- npm run test
|
||||||
|
tags:
|
||||||
|
- javascript
|
||||||
|
only:
|
||||||
|
- master
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist
|
- dist
|
||||||
|
|
|
@ -4,9 +4,9 @@ var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
var commonConfig = require('./webpack.common.js');
|
var commonConfig = require('./webpack.common.js');
|
||||||
var helpers = require('./helpers');
|
var helpers = require('./helpers');
|
||||||
|
|
||||||
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
|
module.exports = function (env) {
|
||||||
|
console.log("env:", env);
|
||||||
module.exports = webpackMerge(commonConfig, {
|
return webpackMerge(commonConfig, {
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
|
@ -26,7 +26,7 @@ module.exports = webpackMerge(commonConfig, {
|
||||||
new ExtractTextPlugin('[name].[hash].css'),
|
new ExtractTextPlugin('[name].[hash].css'),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'ENV': JSON.stringify(ENV)
|
'NODE_ENV': JSON.stringify(env.NODE_ENV)
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new webpack.LoaderOptionsPlugin({
|
new webpack.LoaderOptionsPlugin({
|
||||||
|
@ -36,3 +36,4 @@ module.exports = webpackMerge(commonConfig, {
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
|
@ -66,6 +66,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --inline --progress --port 8080",
|
"start": "webpack-dev-server --inline --progress --port 8080",
|
||||||
"test": "karma start",
|
"test": "karma start",
|
||||||
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail"
|
"build-dev": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail --env.NODE_ENV=development",
|
||||||
|
"build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail --env.NODE_ENV=production"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
|
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
|
||||||
import {AppModule} from "./app/app.module";
|
import {AppModule} from "./app/app.module";
|
||||||
|
import {enableProdMode} from "@angular/core";
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
enableProdMode();
|
||||||
|
}
|
||||||
|
|
||||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||||
|
|
Loading…
Reference in a new issue