diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-05-17 00:00:56 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-05-17 00:00:56 +0900 |
| commit | fb70e3b1769e9d008b75585e7c3fdfa061491f4d (patch) | |
| tree | 0c80a14191c174d850a8021c79ff02b357d63fba /webpack/plugins | |
| parent | Merge pull request #462 from syuilo/greenkeeper/mocha-3.4.1 (diff) | |
| download | sharkey-fb70e3b1769e9d008b75585e7c3fdfa061491f4d.tar.gz sharkey-fb70e3b1769e9d008b75585e7c3fdfa061491f4d.tar.bz2 sharkey-fb70e3b1769e9d008b75585e7c3fdfa061491f4d.zip | |
Refactoring
Diffstat (limited to 'webpack/plugins')
| -rw-r--r-- | webpack/plugins/const.ts | 13 | ||||
| -rw-r--r-- | webpack/plugins/index.ts | 19 |
2 files changed, 32 insertions, 0 deletions
diff --git a/webpack/plugins/const.ts b/webpack/plugins/const.ts new file mode 100644 index 0000000000..ccfcb45260 --- /dev/null +++ b/webpack/plugins/const.ts @@ -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) +}); diff --git a/webpack/plugins/index.ts b/webpack/plugins/index.ts new file mode 100644 index 0000000000..0692b9f8dd --- /dev/null +++ b/webpack/plugins/index.ts @@ -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; +}; |