becomap 1.6.1 → 1.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ const path = require('path');
2
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
3
+ const WebpackObfuscator = require('webpack-obfuscator');
4
+ const TerserPlugin = require('terser-webpack-plugin');
5
+ const Dotenv = require('dotenv-webpack');
6
+
7
+ const envFile = `.env`;
8
+
9
+ module.exports = {
10
+ mode: 'production',
11
+ entry: './src/index.ts',
12
+ output: {
13
+ filename: 'becomap.[contenthash].js',
14
+ chunkFilename: 'becomap.[name].[contenthash].js',
15
+ path: path.resolve(__dirname, 'esm-build'),
16
+ library: 'becomap',
17
+ libraryTarget: 'umd',
18
+ umdNamedDefine: true,
19
+ globalObject: 'this',
20
+ },
21
+ resolve: {
22
+ extensions: ['.ts', '.js'],
23
+ },
24
+ module: {
25
+ rules: [
26
+ {
27
+ test: /\.ts$/,
28
+ use: 'ts-loader',
29
+ exclude: /node_modules/,
30
+ },
31
+ {
32
+ test: /\.css$/,
33
+ use: ['style-loader', 'css-loader'],
34
+ },
35
+ {
36
+ test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
37
+ type: 'asset',
38
+ },
39
+ ],
40
+ },
41
+ optimization: {
42
+ minimize: true,
43
+ minimizer: [
44
+ new TerserPlugin({
45
+ terserOptions: {
46
+ compress: {
47
+ drop_console: false,
48
+ },
49
+ },
50
+ }),
51
+ ],
52
+ splitChunks : {
53
+ chunks: 'all',
54
+ minSize: 30000,
55
+ maxSize: 204800,
56
+ cacheGroups: {
57
+ vendors: {
58
+ test: /[\\/]node_modules[\\/]/,
59
+ name: 'vendors',
60
+ enforce: true,
61
+ priority: -10,
62
+ },
63
+ default: {
64
+ minChunks: 2,
65
+ priority: -20,
66
+ reuseExistingChunk: true,
67
+ },
68
+ }
69
+ },
70
+ runtimeChunk: 'single'
71
+ },
72
+ externalsType: 'window',
73
+ externals: {
74
+ 'maplibre-gl': 'maplibregl',
75
+ '@turf/turf': 'turf'
76
+ },
77
+ plugins: [
78
+ new Dotenv({
79
+ path: envFile,
80
+ }),
81
+ new HtmlWebpackPlugin({
82
+ template: './public/index.html',
83
+ filename: 'index.html',
84
+ inject: 'body',
85
+ }),
86
+ new WebpackObfuscator(
87
+ { stringArray: false },
88
+ ['node_modules/**/*']
89
+ ),
90
+ ],
91
+ };