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 {
|
2019-03-28 20:02:17 +01:00
|
|
|
mode: "production",
|
2017-12-19 13:03:26 +01:00
|
|
|
entry: {
|
2018-10-08 11:27:13 +02:00
|
|
|
'codice.fiscale': './src/codice-fiscale.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: [
|
|
|
|
{
|
2018-10-08 11:27:13 +02:00
|
|
|
test: /\.json$/,
|
|
|
|
loader: 'json-loader'
|
|
|
|
}, {
|
2017-12-19 13:03:26 +01:00
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /(node_modules|bower_components)/,
|
|
|
|
use: {
|
2019-03-28 20:02:17 +01:00
|
|
|
loader: 'babel-loader'
|
2017-12-18 21:53:20 +01:00
|
|
|
}
|
|
|
|
}
|
2017-12-19 13:03:26 +01:00
|
|
|
]
|
2018-10-08 11:27:13 +02:00
|
|
|
},
|
2019-03-28 20:02:17 +01:00
|
|
|
optimization: {
|
|
|
|
minimize: true
|
|
|
|
}
|
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-10-08 11:27:13 +02:00
|
|
|
}, createConfig)
|