forked from visgl/react-map-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
36 lines (30 loc) · 877 Bytes
/
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
const webpack = require('webpack');
const getWebpackConfig = require('ocular-dev-tools/config/webpack.config');
const BABEL_CONFIG = {
presets: ['@babel/env', '@babel/react', '@babel/flow'],
plugins: ['version-inline', '@babel/proposal-class-properties']
};
module.exports = env => {
const config = getWebpackConfig(env);
config.module.rules.push({
// This is required to handle inline worker!
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: BABEL_CONFIG
}
]
});
config.plugins = (config.plugins || []).concat([
new webpack.DefinePlugin({
__MAPBOX_TOKEN__: JSON.stringify(process.env.MapboxAccessToken) // eslint-disable-line
})
]);
if (env.mode === 'size') {
// Only measure self bundle size
config.externals = ['mapbox-gl'];
}
return config;
};