-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.chartjs-config.js
57 lines (54 loc) · 1.86 KB
/
webpack.chartjs-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const webpack = require('webpack');
const path = require('path');
//const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
let _mode = 'production';
// create bundle for fotorama
module.exports = [
{
target: ['web','es2022'],
entry: ['./js/fm_main.js'],
output: {
filename: 'fm_[name].js',
chunkFilename: 'fm_[name].js',
path: path.resolve(__dirname, 'build/fm_chartjs'),
},
//switch-map: active: L in local var, ele not working completely: aktiviere, um L in der lokalen Variable OHNE leaflet-elevation zu laden.
// wenn das aktiv ist muss im file 'LeafletMapClass.js' die Zeile 'import "leaflet"' deaktiviert werden!; Achtung: Leaflet Elevation und NUR Karte mit Marker funktioniert dann nicht!
// wenn das Plugin de-aktiviert ist (mit import leaflet aktiv), dann geht zwar leaflet, aber L ist nicht lokal und es gibt Probleme mit anderen Plugins!
plugins: [new webpack.ProvidePlugin({
L: 'leaflet',
'window.L': 'leaflet',
'root.L' : 'leaflet'
}),
//new webpack.IgnorePlugin({
// resourceRegExp: /^\.\/locale$/,
// contextRegExp: /moment$/,
//}),
//new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /de/),
//new BundleAnalyzerPlugin()
],
// ---------- bis hierher -----------------
mode: _mode,
resolve: {
alias: {
leaf_images: path.resolve(__dirname, 'js/LeafletChartJs')
}
},
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource', // see: https://stackoverflow.com/questions/67186653/webpack-loads-wrong-images-to-dist-directory
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
}];