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