1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-09 06:25:12 +00:00
mon-entreprise/publicodes/webpack.config.js
Johan Girod fd2b5999c4 💚 fix linting
2020-12-11 13:39:42 +01:00

39 lines
783 B
JavaScript

/* eslint-env node */
const path = require('path')
const { commonLoaders } = require('../webpack/common')
const common = {
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
mode: process.env.NODE_ENV,
entry: path.resolve(__dirname, 'source', 'index.ts'),
module: {
rules: commonLoaders({ file: false }),
},
}
module.exports = [
// Config for UMD export (browser / node)
{
...common,
output: {
filename: 'index.js',
library: 'publicodes',
libraryTarget: 'umd',
globalObject: 'this',
},
externals:
// Every non-relative module is external
/^[a-z\-0-9]+$/,
},
process.env.NODE_ENV === 'production' && {
...common,
output: {
filename: 'publicodes.min.js',
library: 'publicodes',
libraryTarget: 'global',
},
},
].filter(Boolean)