diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-17 18:06:35 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-17 18:06:35 +0800 |
commit | 03a6a088c5f1a086c1f3f02a0a70edaea3603860 (patch) | |
tree | bbe67afd2ad3d902444da65964c7401c9d38d63d /packages/website/webpack.config.js | |
parent | 1e787a764615bd3df839f2cb117b711be297b9d5 (diff) | |
parent | a9038f2afc974cecf567a9aef50267d29a995e02 (diff) | |
download | dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.gz dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.bz2 dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.lz dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.xz dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.tar.zst dexon-sol-tools-03a6a088c5f1a086c1f3f02a0a70edaea3603860.zip |
Merge branch 'v2-prototype' into fix-order-watcher
* v2-prototype: (39 commits)
Add chris to website
Fix ocean link
Move update onboarding step tracking to onboarding flow code
Bump npm-run-all from 4.1.2 to 4.1.3
Move format to helper function
Fix linter
Add assertion to make sure caller to fetchAsync isn't trying to set timeout in a context-specific way
Fix linter issues
Remove unused import
Switch conditional
Update yarn.lock and artifact
Fix abi-gen tests to not rely on sleep, since it causes intermittent failures
Add missing assertion
Move type defs to typescript-typingsd
Fix linter
Make createFinalPayload protected
Replace process.browser with detect-node library
Export Web3ProviderEngine and RPCSubprovider from 0x.js
Export Web3ProviderEngine from subproviders package
Update deps
...
Diffstat (limited to 'packages/website/webpack.config.js')
-rw-r--r-- | packages/website/webpack.config.js | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/packages/website/webpack.config.js b/packages/website/webpack.config.js index 5647b4f93..8653196a6 100644 --- a/packages/website/webpack.config.js +++ b/packages/website/webpack.config.js @@ -9,6 +9,43 @@ const GIT_SHA = childProcess .toString() .trim(); +const generatePlugins = () => { + let plugins = []; + if (process.env.NODE_ENV === 'production') { + plugins = plugins.concat([ + // Since we do not use moment's locale feature, we exclude them from the bundle. + // This reduces the bundle size by 0.4MB. + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + new webpack.DefinePlugin({ + 'process.env': { + NODE_ENV: JSON.stringify(process.env.NODE_ENV), + GIT_SHA: JSON.stringify(GIT_SHA), + }, + }), + // TODO: Revert to webpack bundled version with webpack v4. + // The v3 series bundled version does not support ES6 and + // fails to build. + new UglifyJsPlugin({ + sourceMap: true, + uglifyOptions: { + mangle: { + reserved: ['BigNumber'], + }, + }, + }), + ]); + if (process.env.DEPLOY_ROLLBAR_SOURCEMAPS === 'true') { + plugins = plugins.concat([ + new RollbarSourceMapPlugin({ + accessToken: '32c39bfa4bb6440faedc1612a9c13d28', + version: GIT_SHA, + publicPath: 'https://0xproject.com/', + }), + ]); + } + } + return plugins; +}; module.exports = { entry: ['./ts/index.tsx'], output: { @@ -78,34 +115,5 @@ module.exports = { }, disableHostCheck: true, }, - plugins: - process.env.NODE_ENV === 'production' - ? [ - // Since we do not use moment's locale feature, we exclude them from the bundle. - // This reduces the bundle size by 0.4MB. - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), - new webpack.DefinePlugin({ - 'process.env': { - NODE_ENV: JSON.stringify(process.env.NODE_ENV), - GIT_SHA: JSON.stringify(GIT_SHA), - }, - }), - // TODO: Revert to webpack bundled version with webpack v4. - // The v3 series bundled version does not support ES6 and - // fails to build. - new UglifyJsPlugin({ - sourceMap: true, - uglifyOptions: { - mangle: { - reserved: ['BigNumber'], - }, - }, - }), - new RollbarSourceMapPlugin({ - accessToken: '32c39bfa4bb6440faedc1612a9c13d28', - version: GIT_SHA, - publicPath: 'https://0xproject.com/', - }), - ] - : [], + plugins: generatePlugins(), }; |