Use ServiceWorker for Contract compilation
This commit is contained in:
@@ -22,6 +22,7 @@ const WebpackErrorNotificationPlugin = require('webpack-error-notification');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
|
||||
|
||||
const Shared = require('./shared');
|
||||
const DAPPS = require('../src/dapps');
|
||||
@@ -50,7 +51,7 @@ module.exports = {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
exclude: /(node_modules)/,
|
||||
// use: [ 'happypack/loader?id=js' ]
|
||||
use: isProd ? ['babel-loader'] : [
|
||||
'babel-loader?cacheDirectory=true'
|
||||
@@ -136,7 +137,18 @@ module.exports = {
|
||||
},
|
||||
|
||||
plugins: (function () {
|
||||
const plugins = Shared.getPlugins().concat([
|
||||
const DappsHTMLInjection = DAPPS.map((dapp) => {
|
||||
return new HtmlWebpackPlugin({
|
||||
title: dapp.title,
|
||||
filename: dapp.name + '.html',
|
||||
template: './dapps/index.ejs',
|
||||
favicon: FAVICON,
|
||||
secure: dapp.secure,
|
||||
chunks: [ isProd ? null : 'commons', dapp.name ]
|
||||
});
|
||||
});
|
||||
|
||||
const plugins = Shared.getPlugins().concat(
|
||||
new CopyWebpackPlugin([{ from: './error_pages.css', to: 'styles.css' }], {}),
|
||||
new WebpackErrorNotificationPlugin(),
|
||||
|
||||
@@ -151,17 +163,14 @@ module.exports = {
|
||||
template: './index.ejs',
|
||||
favicon: FAVICON,
|
||||
chunks: [ isProd ? null : 'commons', 'index' ]
|
||||
})
|
||||
], DAPPS.map((dapp) => {
|
||||
return new HtmlWebpackPlugin({
|
||||
title: dapp.title,
|
||||
filename: dapp.name + '.html',
|
||||
template: './dapps/index.ejs',
|
||||
favicon: FAVICON,
|
||||
secure: dapp.secure,
|
||||
chunks: [ isProd ? null : 'commons', dapp.name ]
|
||||
});
|
||||
}));
|
||||
}),
|
||||
|
||||
new ServiceWorkerWebpackPlugin({
|
||||
entry: path.join(__dirname, '../src/serviceWorker.js'),
|
||||
}),
|
||||
|
||||
DappsHTMLInjection
|
||||
);
|
||||
|
||||
if (!isProd) {
|
||||
const DEST_I18N = path.join(__dirname, '..', DEST, 'i18n');
|
||||
|
||||
Reference in New Issue
Block a user