Choices/webpack.config.prod.js
Josh Johnson 5c9dfdf2db
Upgrade old packages (#508)
* 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
2019-02-09 18:13:25 +00:00

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,
},
},
],
},
};