-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js
53 lines (52 loc) · 1.48 KB
/
webpack.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
const path = require("path");
const webpack = require("webpack");
const packageJSON = require("./package.json");
module.exports = {
mode: "production",
entry: {
"meteoJS.min": "./src/meteoJS/index.js",
},
devtool: "source-map",
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader'
}
}, {
test: /\.svg$/,
include: [
path.resolve(__dirname, 'node_modules/bootstrap-icons')
],
loader: "raw-loader"
}]
},
output: {
path: path.resolve(__dirname, "."),
filename: "[name].js",
library: "meteoJS",
libraryTarget: "var"
},
externals: [{
'popper.js': 'Poppers',
jquery: 'jQuery',
leaflet: 'L',
'@svgdotjs/svg.js': 'SVG'
},
function (context, request, callback) {
if (/^ol($|\/)/.test(request))
return callback(null, request.replace(/\//g, '.'));
if (/^bootstrap($|\/)/.test(request) ||
(/\/bootstrap($|\/)/.test(context) &&
/\.\//.test(request)))
return callback(null, 'bootstrap');
callback();
}],
plugins: [
new webpack.BannerPlugin({
banner: 'var SVG = SVG ? SVG : {}; var jQuery = jQuery ? jQuery : {}; var ol = ol ? ol : { layer: {}, source: {}, format: {}, style: {} }; var Popper = Popper ? Popper : {}; var bootstrap = bootstrap ? bootstrap : {};',
raw: true
}),
new webpack.BannerPlugin(`/*meteoJS v${packageJSON.version} | (c) ${packageJSON.author.name} | https://chird.github.io/meteoJS/LICENSE*/`)
]
};