Refactoring
This commit is contained in:
13
webpack/plugins/const.ts
Normal file
13
webpack/plugins/const.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Constant Replacer
|
||||
*/
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
import version from '../../src/version';
|
||||
const constants = require('../../src/const.json');
|
||||
|
||||
export default () => new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(version),
|
||||
THEME_COLOR: JSON.stringify(constants.themeColor)
|
||||
});
|
19
webpack/plugins/index.ts
Normal file
19
webpack/plugins/index.ts
Normal file
@ -0,0 +1,19 @@
|
||||
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
||||
|
||||
import constant from './const';
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
const isProduction = env === 'production';
|
||||
|
||||
export default () => {
|
||||
const plugins = [
|
||||
constant(),
|
||||
new StringReplacePlugin()
|
||||
];
|
||||
|
||||
if (isProduction) {
|
||||
//plugins.push(new webpack.optimize.UglifyJsPlugin());
|
||||
}
|
||||
|
||||
return plugins;
|
||||
};
|
Reference in New Issue
Block a user