2017-08-18 06:01:03 +02:00
|
|
|
const path = require('path');
|
2019-10-22 18:08:43 +02:00
|
|
|
const deepMerge = require('deepmerge');
|
2019-10-23 09:45:49 +02:00
|
|
|
const { BannerPlugin } = require('webpack');
|
2017-11-15 07:51:53 +01:00
|
|
|
|
2019-10-22 18:08:43 +02:00
|
|
|
const baseConfig = require('./webpack.config.base');
|
|
|
|
const { name, version, author, homepage } = require('./package.json');
|
2016-03-15 23:42:10 +01:00
|
|
|
|
2019-10-22 18:08:43 +02:00
|
|
|
const arrayMerge = (target, source) => [...source, ...target];
|
2016-08-23 08:24:45 +02:00
|
|
|
|
2019-10-22 18:08:43 +02:00
|
|
|
const prodConfig = deepMerge(
|
|
|
|
baseConfig,
|
|
|
|
{
|
|
|
|
mode: 'production',
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, '/public/assets/scripts'),
|
|
|
|
publicPath: '/public/assets/scripts/',
|
2017-11-06 23:06:38 +01:00
|
|
|
},
|
2019-10-22 18:08:43 +02:00
|
|
|
plugins: [
|
2019-10-23 09:45:49 +02:00
|
|
|
new BannerPlugin(
|
|
|
|
`${name} v${version} | © ${new Date().getFullYear()} ${author} | ${homepage}`,
|
|
|
|
),
|
2019-02-09 19:13:25 +01:00
|
|
|
],
|
|
|
|
},
|
2019-10-22 18:08:43 +02:00
|
|
|
{
|
|
|
|
arrayMerge,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
deepMerge(
|
|
|
|
prodConfig,
|
|
|
|
{
|
2019-10-24 19:21:40 +02:00
|
|
|
output: { filename: 'choices.js', libraryTarget: 'umd' },
|
2019-10-22 18:08:43 +02:00
|
|
|
optimization: { minimize: false },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arrayMerge,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
deepMerge(
|
|
|
|
prodConfig,
|
|
|
|
{ output: { filename: 'choices.min.js' } },
|
|
|
|
{
|
|
|
|
arrayMerge,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
];
|