CodiceFiscaleJS/webpack.config.js

40 lines
869 B
JavaScript
Raw Normal View History

2017-12-19 09:36:43 +01:00
const path = require('path')
const webpack = require('webpack')
const createVariants = require('parallel-webpack').createVariants
2017-03-10 12:03:36 +01:00
function createConfig (options) {
return {
entry: {
2018-09-03 14:59:53 +02:00
'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: {
2018-09-03 14:59:53 +02:00
presets: ["@babel/preset-env", "babel-preset-minify"]
}
2017-12-18 21:53:20 +01:00
}
}
]
2018-09-03 14:59:53 +02:00
}
}
2017-12-19 09:36:43 +01:00
}
module.exports = createVariants({
target: [
'var',
'commonjs2',
'umd',
'amd'
]
2018-09-03 14:59:53 +02:00
}, createConfig)