Expose a new export: without-countries

This commit is contained in:
Basile Bruneau
2021-04-23 23:42:01 +02:00
committed by Basile Bruneau
parent a6873175d3
commit 571696b296
11 changed files with 425 additions and 242 deletions
+25 -4
View File
@@ -1,16 +1,37 @@
const path = require('path');
const fs = require('fs');
class CleanOutput {
apply(compiler) {
compiler.hooks.thisCompilation.tap('CleanOutput', () => {
if (fs.existsSync('./index.js')) {
fs.rmSync('./index.js');
}
if (fs.existsSync('./without-countries.js')) {
fs.rmSync('./without-countries.js');
}
});
}
}
module.exports = {
entry: './src/index.js',
entry: {
index: './src/with-countries.js',
'without-countries': './src/without-countries.js',
},
mode: 'production',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'dotted-map.js',
path: path.resolve(__dirname),
filename: '[name].js',
library: {
name: 'dotted-map',
type: 'umd',
},
globalObject: 'this',
clean: true,
},
externals: {
'@turf/boolean-point-in-polygon': '@turf/boolean-point-in-polygon',
proj4: 'proj4',
},
plugins: [new CleanOutput()],
};