joyent-portal/ui/webpack/production.js

32 lines
958 B
JavaScript
Raw Normal View History

2016-10-23 07:27:18 +03:00
const WebpackShellPlugin = require('webpack-shell-plugin');
2016-10-24 16:13:02 +03:00
const base = require('./base.js');
2016-10-23 07:27:18 +03:00
const webpack = require('webpack');
const entries = require('./entrypoints');
const path = require('path');
2016-10-23 07:27:18 +03:00
2016-10-24 16:13:02 +03:00
module.exports = Object.assign(base.config, {
2016-10-23 07:27:18 +03:00
entry: entries.reduce((all, entry) => {
all[entry.name] = [`./${path.relative(base.config.context, entry.path)}`];
2016-10-23 07:27:18 +03:00
return all;
}, {}),
2016-10-24 16:13:02 +03:00
plugins: base.config.plugins.concat([
2016-10-23 07:27:18 +03:00
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurrenceOrderPlugin(true),
new webpack.optimize.UglifyJsPlugin(),
new WebpackShellPlugin({
onBuildEnd: [
'npm run build-docs-static'
]
})
]),
devtool: 'eval'
});
/*
* Maybe add in the future:
* - https://github.com/lettertwo/appcache-webpack-plugin
* - https://github.com/NekR/offline-plugin
* - https://github.com/goldhand/sw-precache-webpack-plugin
* - https://github.com/Klathmon/imagemin-webpack-plugin
*/