forked from visgl/react-map-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
39 lines (33 loc) · 1.04 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
const webpack = require('webpack');
const {getWebpackConfig} = require('ocular-dev-tools');
module.exports = env => {
const config = getWebpackConfig(env);
config.resolve = {...config.resolve, extensions: ['.ts', '.tsx', '.js', '.json']};
config.module.rules = [
...config.module.rules.filter(r => r.loader !== 'babel-loader'),
{
// Compile source using babel
test: /(\.js|\.ts|\.tsx)$/,
loader: 'babel-loader',
exclude: [/node_modules/],
options: {
presets: [
['@babel/preset-env', {targets: 'last 2 chrome versions'}],
'@babel/preset-react',
'@babel/preset-typescript'
],
plugins: ['@babel/plugin-proposal-class-properties']
}
}
];
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;
};