mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-08 08:52:19 +02:00
5c9dfdf2db
* Upgrade Webpack to v4 * Upgrade Mocha * Export unminfied and minified version * Add browserslistrc * Remove core.js polyfills * Run bundle size on pre push * Run bundlesize last * Update readme gzip side
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
const path = require('path');
|
|
const WrapperPlugin = require('wrapper-webpack-plugin');
|
|
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
|
|
|
|
const pkg = require('./package.json');
|
|
|
|
const banner = `/*! ${pkg.name} v${
|
|
pkg.version
|
|
} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
entry: ['./src/scripts/choices'],
|
|
output: {
|
|
path: path.join(__dirname, '/public/assets/scripts'),
|
|
filename: 'choices.min.js',
|
|
publicPath: '/public/assets/scripts/',
|
|
library: 'Choices',
|
|
libraryTarget: 'umd',
|
|
auxiliaryComment: {
|
|
root: 'Window',
|
|
commonjs: 'CommonJS',
|
|
commonjs2: 'CommonJS2',
|
|
amd: 'AMD',
|
|
},
|
|
},
|
|
plugins: [
|
|
new WrapperPlugin({
|
|
header: banner,
|
|
}),
|
|
new UnminifiedWebpackPlugin(),
|
|
],
|
|
module: {
|
|
rules: [
|
|
{
|
|
enforce: 'pre',
|
|
test: /\.js?$/,
|
|
include: path.join(__dirname, 'src/scripts'),
|
|
exclude: /(node_modules|bower_components)/,
|
|
loader: 'eslint-loader',
|
|
query: {
|
|
configFile: '.eslintrc',
|
|
},
|
|
},
|
|
{
|
|
test: /\.js?$/,
|
|
include: path.join(__dirname, 'src/scripts'),
|
|
exclude: /(node_modules|bower_components)/,
|
|
loader: 'babel-loader',
|
|
options: {
|
|
babelrc: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|