CodiceFiscaleJS/webpack.config.js
Valentina Vandro 617e1c9538 v2.0.0 released
2018-09-03 14:59:53 +02:00

40 lines
869 B
JavaScript

const path = require('path')
const webpack = require('webpack')
const createVariants = require('parallel-webpack').createVariants
function createConfig (options) {
return {
entry: {
'codice.fiscale': './build/js/main.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'codice.fiscale.' + options.target + '.js',
library: 'CodiceFiscale',
libraryTarget: options.target
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ["@babel/preset-env", "babel-preset-minify"]
}
}
}
]
}
}
}
module.exports = createVariants({
target: [
'var',
'commonjs2',
'umd',
'amd'
]
}, createConfig)