Update build

This commit is contained in:
Jaco Greeff 2017-08-03 16:50:35 +02:00
parent 34f9e69bff
commit e7641e38d8
2 changed files with 343 additions and 213 deletions

463
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const flatten = require('lodash.flatten'); const flatten = require('lodash.flatten');
// const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin'); // const ReactIntlAggregatePlugin = require('react-intl-aggregate-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const WebpackErrorNotificationPlugin = require('webpack-error-notification'); const WebpackErrorNotificationPlugin = require('webpack-error-notification');
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
@ -83,8 +84,9 @@ module.exports = {
{ {
test: /\.css$/, test: /\.css$/,
include: /semantic-ui-css/, include: /semantic-ui-css/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [ use: [
'style-loader',
{ {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
@ -92,12 +94,14 @@ module.exports = {
} }
} }
] ]
})
}, },
{ {
test: /\.css$/, test: /\.css$/,
exclude: /semantic-ui-css/, exclude: /semantic-ui-css/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [ use: [
'style-loader',
{ {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
@ -119,14 +123,17 @@ module.exports = {
} }
} }
] ]
})
}, },
{ {
test: /\.(png|jpg|svg|woff|woff2|ttf|eot|otf)(\?.*)?$/, test: /\.(png|jpg|svg|woff|woff2|ttf|eot|otf)(\?.*)?$/,
use: { use: {
loader: 'file-loader', loader: 'file-loader',
options: { options: {
name: '[name].[hash:base64:10].[ext]', name: '[name].[hash:10].[ext]',
useRelativePath: true outputPath: '',
publicPath: '',
useRelativePath: false
} }
} }
} }
@ -153,7 +160,10 @@ module.exports = {
plugins: (function () { plugins: (function () {
let plugins = Shared.getPlugins().concat( let plugins = Shared.getPlugins().concat(
new WebpackErrorNotificationPlugin() new WebpackErrorNotificationPlugin(),
new ExtractTextPlugin({
filename: `${isEmbed ? 'embed' : 'bundle'}.css`
}),
); );
if (!isEmbed) { if (!isEmbed) {
@ -187,16 +197,13 @@ module.exports = {
? dapp.id ? dapp.id
: Api.util.sha3(dapp.url); : Api.util.sha3(dapp.url);
return [ return ['index.html', 'dist.css', 'dist.css.map', 'dist.js', 'dist.js.map'].map((file) => ({
{ from: path.join(dir, file),
to: `dapps/${destination}/`
})).concat({
from: path.join(dir, 'dist'), from: path.join(dir, 'dist'),
to: `dapps/${destination}/dist/` to: `dapps/${destination}/dist/`
}, });
{
from: path.join(dir, 'index.html'),
to: `dapps/${destination}/`
}
];
}) })
.filter((copy) => copy) .filter((copy) => copy)
) )