-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
49 lines (48 loc) · 1.37 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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
'lib': './src/index.js',
'demo': './demo/index.js'
},
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
}
},
module: {
rules: [
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
],
},
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
// inject: false,
title: 'Mapbox GL JS Draw Feature Info',
// bodyHtmlSnippet: '<div id="map"></div>',
})
],
resolve: {
fallback: {
fs: false
},
alias: {
// mapbox-gl related packages in webpack should use dist instead of the default src
'@mapbox/mapbox-gl-draw-dist': path.resolve(__dirname, 'node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.js'),
}
},
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist'),
library: 'mapboxglFeatureInfo',
libraryTarget: 'global',
clean: true
},
};