From cbd32035c8e36cb3ddcb91ac2ac3d5df7d1e9d62 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 2 Aug 2017 08:44:56 +0200 Subject: [PATCH] Cleanup webpack config --- js/webpack/shared.js | 55 ++++---------------------------------------- js/webpack/test.js | 10 +------- 2 files changed, 6 insertions(+), 59 deletions(-) diff --git a/js/webpack/shared.js b/js/webpack/shared.js index b65856966..07f451132 100644 --- a/js/webpack/shared.js +++ b/js/webpack/shared.js @@ -15,13 +15,13 @@ // along with Parity. If not, see . const webpack = require('webpack'); -const path = require('path'); -const fs = require('fs'); const HappyPack = require('happypack'); -const CircularDependencyPlugin = require('circular-dependency-plugin'); const PackageJson = require('../package.json'); +const EMBED = process.env.EMBED; +const ENV = process.env.NODE_ENV || 'development'; +const isProd = ENV === 'production'; const UI_VERSION = PackageJson .version .split('.') @@ -33,43 +33,6 @@ const UI_VERSION = PackageJson return `${parseInt(part, 10) + 1}`; }) .join('.'); -const EMBED = process.env.EMBED; -const ENV = process.env.NODE_ENV || 'development'; -const isProd = ENV === 'production'; - -function getBabelrc () { - const babelrc = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../.babelrc'))); - - const es2015Index = babelrc.presets.findIndex((p) => p === 'es2015'); - - // [ "es2015", { "modules": false } ] - babelrc.presets[es2015Index] = [ 'es2015', { modules: false } ]; - babelrc['babelrc'] = false; - - const BABEL_PRESET_ENV = process.env.BABEL_PRESET_ENV; - const npmStart = process.env.npm_lifecycle_event === 'start'; - const npmStartApp = process.env.npm_lifecycle_event === 'start:app'; - - if (BABEL_PRESET_ENV && (npmStart || npmStartApp)) { - console.log('using babel-preset-env'); - - babelrc.presets = [ - // 'es2017', - 'stage-0', 'react', - [ - 'env', - { - targets: { browsers: ['last 2 Chrome versions'] }, - modules: false, - loose: true, - useBuiltIns: true - } - ] - ]; - } - - return babelrc; -} function getPlugins (_isProd = isProd) { const plugins = [ @@ -93,13 +56,6 @@ function getPlugins (_isProd = isProd) { if (_isProd) { plugins.push( - new webpack.optimize.OccurrenceOrderPlugin(!_isProd), - - new CircularDependencyPlugin({ - exclude: /node_modules/, - failOnError: true - }), - new webpack.optimize.UglifyJsPlugin({ screwIe8: true, compress: { @@ -147,7 +103,6 @@ function addProxies (app) { } module.exports = { - getBabelrc: getBabelrc, - getPlugins: getPlugins, - addProxies: addProxies + getPlugins, + addProxies }; diff --git a/js/webpack/test.js b/js/webpack/test.js index f01eb4e24..9f116ff40 100644 --- a/js/webpack/test.js +++ b/js/webpack/test.js @@ -20,15 +20,7 @@ module.exports = { context: path.join(__dirname, '../src'), resolve: { alias: { - '~': path.resolve(__dirname, '..'), - '@parity/abi': path.resolve(__dirname, '../node_modules/@parity/abi'), - '@parity/api': path.resolve(__dirname, '../node_modules/@parity/api'), - '@parity/etherscan': path.resolve(__dirname, '../node_modules/@parity/etherscan'), - '@parity/jsonrpc': path.resolve(__dirname, '../node_modules/@parity/jsonrpc'), - '@parity/shared': path.resolve(__dirname, '../node_modules/@parity/shared'), - '@parity/ui': path.resolve(__dirname, '../node_modules/@parity/ui'), - '@parity/wordlist': path.resolve(__dirname, '../node_modules/@parity/wordlist'), - '@parity': path.resolve(__dirname, '../packages') + '~': path.resolve(__dirname, '..') } } };