Refactoring

This commit is contained in:
syuilo
2017-05-17 00:00:56 +09:00
parent e237c53766
commit fb70e3b176
12 changed files with 202 additions and 121 deletions

13
webpack/plugins/const.ts Normal file
View 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
View 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;
};