CodiceFiscaleJS/webpack.config.js

45 lines
913 B
JavaScript
Raw Permalink 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 {
mode: "production",
entry: {
2018-10-08 11:27:13 +02:00
'codice.fiscale': './src/codice-fiscale.js'
},
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'
}, {
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'
2017-12-18 21:53:20 +01:00
}
}
]
2018-10-08 11:27:13 +02:00
},
optimization: {
minimize: true
}
}
2017-12-19 09:36:43 +01:00
}
module.exports = createVariants({
target: [
'var',
'commonjs2',
'umd',
'amd'
]
2018-10-08 11:27:13 +02:00
}, createConfig)