parent
165c93b248
commit
6ba1035b69
10 changed files with 45 additions and 11 deletions
|
@ -1,4 +1,7 @@
|
|||
import * as fs from 'fs';
|
||||
import * as webpack from 'webpack';
|
||||
const WebpackOnBuildPlugin = require('on-build-webpack');
|
||||
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||
import chalk from 'chalk';
|
||||
|
||||
|
@ -11,6 +14,7 @@ const isProduction = env === 'production';
|
|||
|
||||
export default (version, lang) => {
|
||||
const plugins = [
|
||||
new HardSourceWebpackPlugin(),
|
||||
new ProgressBarPlugin({
|
||||
format: chalk` {cyan.bold yes we can} {bold [}:bar{bold ]} {green.bold :percent} {gray (:current/:total)} :elapseds`,
|
||||
clear: false
|
||||
|
@ -20,6 +24,11 @@ export default (version, lang) => {
|
|||
'process.env': {
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
|
||||
}
|
||||
}),
|
||||
new WebpackOnBuildPlugin(stats => {
|
||||
fs.writeFileSync('./version.json', JSON.stringify({
|
||||
version
|
||||
}), 'utf-8');
|
||||
})
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue