2016-10-31 16:24:31 +02:00
|
|
|
const path = require('path');
|
2016-10-23 07:27:18 +03:00
|
|
|
|
2016-12-05 22:11:55 +02:00
|
|
|
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)}`];
|
2016-10-23 07:27:18 +03:00
|
|
|
return all;
|
|
|
|
}, {}),
|
2016-12-05 22:11:55 +02:00
|
|
|
plugins: base.plugins.concat([
|
|
|
|
plugins['occurrence-order'],
|
|
|
|
plugins['aggressive-merging'],
|
|
|
|
plugins['uglify-js']
|
2016-10-23 07:27:18 +03:00
|
|
|
]),
|
2016-12-05 22:11:55 +02:00
|
|
|
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('')
|
|
|
|
}])
|
|
|
|
})
|
2016-10-23 07:27:18 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
*/
|