mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-08 00:42:15 +02:00
bef6743c3b
* set `globalObject` option * commit builded assets * set window target for minified build
48 lines
998 B
JavaScript
48 lines
998 B
JavaScript
const path = require('path');
|
|
const deepMerge = require('deepmerge');
|
|
const { BannerPlugin } = require('webpack');
|
|
|
|
const baseConfig = require('./webpack.config.base');
|
|
const { name, version, author, homepage } = require('./package.json');
|
|
|
|
const arrayMerge = (target, source) => [...source, ...target];
|
|
|
|
const prodConfig = deepMerge(
|
|
baseConfig,
|
|
{
|
|
mode: 'production',
|
|
output: {
|
|
path: path.join(__dirname, '/public/assets/scripts'),
|
|
publicPath: '/public/assets/scripts/',
|
|
},
|
|
plugins: [
|
|
new BannerPlugin(
|
|
`${name} v${version} | © ${new Date().getFullYear()} ${author} | ${homepage}`,
|
|
),
|
|
],
|
|
},
|
|
{
|
|
arrayMerge,
|
|
},
|
|
);
|
|
|
|
module.exports = [
|
|
deepMerge(
|
|
prodConfig,
|
|
{
|
|
output: { filename: 'choices.js', libraryTarget: 'umd' },
|
|
optimization: { minimize: false },
|
|
},
|
|
{
|
|
arrayMerge,
|
|
},
|
|
),
|
|
deepMerge(
|
|
prodConfig,
|
|
{ output: { filename: 'choices.min.js' } },
|
|
{
|
|
arrayMerge,
|
|
},
|
|
),
|
|
];
|