Choices/webpack.config.prod.js

57 lines
1.3 KiB
JavaScript
Raw Normal View History

const path = require('path');
2017-11-15 07:51:53 +01:00
const WrapperPlugin = require('wrapper-webpack-plugin');
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
2017-11-15 07:51:53 +01:00
const pkg = require('./package.json');
2016-03-15 23:42:10 +01:00
const banner = `/*! ${pkg.name} v${
pkg.version
} | (c) ${new Date().getFullYear()} ${pkg.author} | ${pkg.homepage} */ \n`;
2016-08-23 08:24:45 +02:00
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',
2017-11-06 23:06:38 +01:00
},
},
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',
2017-11-06 23:06:38 +01:00
},
},
{
test: /\.js?$/,
include: path.join(__dirname, 'src/scripts'),
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
options: {
babelrc: true,
},
2017-11-15 07:51:53 +01:00
},
],
},
2017-11-06 23:06:38 +01:00
};