1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-11 05:40:11 +02:00
copilot/ui/webpack/production.js
Sérgio Ramos 0189d7d29a re-organize webpack configuration
- detach plugins configuration
 - use aliases
 - add project root to frontend module resolver
2016-12-05 20:11:55 +00:00

49 lines
1.3 KiB
JavaScript

const path = require('path');
const plugins = require('./plugins');
const base = require('./base');
const entries = require('./entrypoints');
const SRC = path.join(__dirname, '../src');
module.exports = Object.assign(base, {
output: Object.assign(base.output, {
libraryTarget: 'commonjs2'
}),
entry: entries.filter((entry) => {
return entry.name !== 'docs';
}).reduce((all, entry) => {
all[entry.name] = [`./${path.relative(base.context, entry.path)}`];
return all;
}, {}),
plugins: base.plugins.concat([
plugins['occurrence-order'],
plugins['aggressive-merging'],
plugins['uglify-js']
]),
module: Object.assign(base.module, {
loaders: base.module.loaders.concat([{
test: /\.css?$/,
exclude: /node_modules/,
include: [
SRC
],
loader: [
'style-loader!',
'css-loader?',
'modules&importLoaders=1&',
'localIdentName=[name]__[local]___[hash:base64:5]!',
'postcss-loader'
].join('')
}])
})
});
/*
* 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
*/