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,50 +84,56 @@ module.exports = {
{ {
test: /\.css$/, test: /\.css$/,
include: /semantic-ui-css/, include: /semantic-ui-css/,
use: [ use: ExtractTextPlugin.extract({
'style-loader', fallback: 'style-loader',
{ use: [
loader: 'css-loader', {
options: { loader: 'css-loader',
minimize: true options: {
minimize: true
}
} }
} ]
] })
}, },
{ {
test: /\.css$/, test: /\.css$/,
exclude: /semantic-ui-css/, exclude: /semantic-ui-css/,
use: [ use: ExtractTextPlugin.extract({
'style-loader', fallback: 'style-loader',
{ use: [
loader: 'css-loader', {
options: { loader: 'css-loader',
importLoaders: 1, options: {
localIdentName: '[name]_[local]_[hash:base64:10]', importLoaders: 1,
minimize: true, localIdentName: '[name]_[local]_[hash:base64:10]',
modules: true minimize: true,
modules: true
}
},
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: [
require('postcss-import'),
require('postcss-nested'),
require('postcss-simple-vars')
]
}
} }
}, ]
{ })
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: [
require('postcss-import'),
require('postcss-nested'),
require('postcss-simple-vars')
]
}
}
]
}, },
{ {
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),
from: path.join(dir, 'dist'), to: `dapps/${destination}/`
to: `dapps/${destination}/dist/` })).concat({
}, from: path.join(dir, 'dist'),
{ to: `dapps/${destination}/dist/`
from: path.join(dir, 'index.html'), });
to: `dapps/${destination}/`
}
];
}) })
.filter((copy) => copy) .filter((copy) => copy)
) )