Shared build rules

This commit is contained in:
Jaco Greeff 2017-04-20 11:17:58 +02:00
parent 94c8cceb42
commit 8b144bedd1
5 changed files with 55 additions and 27 deletions

View File

@ -25,6 +25,8 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared');
const DAPPS = require('../src/views/Dapps/builtin.json');
@ -60,22 +62,13 @@ module.exports = {
module: {
rules: [
rulesParity,
rulesEs6,
{
test: /\.js$/,
exclude: /(node_modules)/,
use: [ 'happypack/loader?id=babel-js' ]
},
// duplicated for clarity since the number of @parity modules will increase
{
test: /\.js$/,
include: /node_modules\/@parity\/(abi|api|jsonrpc|wordlist)/,
use: 'babel-loader'
},
{
test: /\.js$/,
include: /node_modules\/(material-chip-input|ethereumjs-tx)/,
use: 'babel-loader'
},
{
test: /\.json$/,
use: [ 'json-loader' ]

View File

@ -18,6 +18,8 @@
const path = require('path');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared');
const DEST = process.env.BUILD_DEST || '.build';
@ -49,6 +51,8 @@ module.exports = {
module: {
rules: [
rulesParity,
rulesEs6,
{
test: /\.js$/,
exclude: /node_modules/,
@ -58,17 +62,6 @@ module.exports = {
'babel-loader?cacheDirectory=true'
]
},
// duplicated for clarity since the number of @parity modules will increase
{
test: /\.js$/,
include: /node_modules\/@parity\/(abi|api|jsonrpc|wordlist)/,
use: 'babel-loader'
},
{
test: /\.js$/,
include: /node_modules\/ethereumjs-tx/,
use: 'babel-loader'
},
{
test: /\.json$/,
use: [ 'json-loader' ]

View File

@ -18,6 +18,8 @@ const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const packageJson = require('../package.json');
const rulesEs6 = require('./rules/es6');
const rulesParity = require('./rules/parity');
const Shared = require('./shared');
const ENV = process.env.NODE_ENV || 'development';
@ -26,6 +28,7 @@ const isProd = ENV === 'production';
const LIBRARY = process.env.LIBRARY;
if (!LIBRARY) {
console.error('$LIBRARY environment variable not defined');
process.exit(-1);
}
@ -57,6 +60,8 @@ module.exports = {
/babel-polyfill/
],
rules: [
rulesParity,
rulesEs6,
{
test: /(\.jsx|\.js)$/,
// use: [ 'happypack/loader?id=js' ],
@ -65,11 +70,6 @@ module.exports = {
'babel-loader?cacheDirectory=true'
],
exclude: /node_modules/
},
{
test: /\.js$/,
include: /node_modules\/(ethereumjs-tx|@parity\/wordlist)/,
use: 'babel-loader'
}
]
},

21
js/webpack/rules/es6.js Normal file
View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
module.exports = {
test: /\.js$/,
include: /node_modules\/(material-chip-input|ethereumjs-tx)/,
use: 'babel-loader'
};

View File

@ -0,0 +1,21 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
module.exports = {
test: /\.js$/,
include: /node_modules\/@parity\/(abi|api|jsonrpc|wordlist)/,
use: 'babel-loader'
};