1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-01 15:45:58 +09:00
cherrypick/webpack/plugins/index.ts
2018-02-25 14:32:37 +09:00

29 lines
582 B
TypeScript

import * as webpack from 'webpack';
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
import consts from './consts';
import hoist from './hoist';
import minify from './minify';
const env = process.env.NODE_ENV;
const isProduction = env === 'production';
export default (version, lang) => {
const plugins = [
new ProgressBarPlugin(),
consts(lang),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
];
if (isProduction) {
plugins.push(hoist());
plugins.push(minify());
}
return plugins;
};