-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
48 lines (46 loc) · 1.33 KB
/
webpack.common.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const webpack = require('webpack');
const BACKEND_LOCATION = process.env.BACKEND_LOCATION || "trips/";
const MAPBOX_TOKEN = process.env.MAPBOX_TOKEN || "";
const MAPBOX_STYLE = process.env.MAPBOX_STYLE || "mapbox://styles/grounded042/cjehkrz116lxq2qqq1k1hlpre";
module.exports = {
entry: [
'./src/index.jsx'
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [{
test: /\.jsx?$/,
exclude: /(node_modules\/)/,
loader: "babel-loader"
},
{
test: /\.json$/,
exclude: /(node_modules\/)/,
loader: 'json-loader'
}
]
},
resolve: {
alias: {
// From mapbox-gl-js README. Required for non-browserify bundlers (e.g. webpack):
'mapbox-gl$': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js')
}
},
plugins: [
new CleanWebpackPlugin(['dist']),
new HtmlWebpackPlugin({
template: 'src/template.html'
}),
new webpack.DefinePlugin({
CONFIG_BACKEND_LOCATION: JSON.stringify(BACKEND_LOCATION),
CONFIG_MAPBOX_TOKEN: JSON.stringify(MAPBOX_TOKEN),
CONFIG_MAPBOX_STYLE: JSON.stringify(MAPBOX_STYLE)
})
]
};