-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (67 loc) · 1.69 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const path = require('path')
const resolve = path.resolve
module.exports = {
entry: './index.js',
output: {
filename: 'bundle.js',
path: './dist'
},
context: resolve(__dirname, 'src'),
module: {
loaders: [
{ test: /\.js$/,
loaders: [
'babel-loader',
],
exclude: /node_modules/
},
{
test: /\.css$/,
loaders: [
'style-loader',
'css-loader',
// 'postcss-loader',
],
},
// for mapbox gl js
{
test: /\.json$/,
exclude: path.resolve(__dirname, 'data/gear.json'),
loader: 'json-loader'
},
{
test: /\.js$/,
include: path.resolve(__dirname, 'node_modules/webworkify/index.js'),
loader: 'worker'
},
{
// test: /mapbox-gl.+\.js$/,
// include: /node_modules\/mapbox-gl/,
include: path.resolve(__dirname, 'node_modules/mapbox-gl/js/render/shaders.js'),
loader: 'transform/cacheable?brfs',
enforce: 'post'
}
],
},
resolve: {
// extensions: ['', '.js'], // this was breaking the map gl stuff?
alias: {
webworkify: 'webworkify-webpack',
'mapbox-gl': path.resolve('./node_modules/mapbox-gl/dist/mapbox-gl.js')
}
},
plugins: [
// new webpack.HotModuleReplacementPlugin(),
// activates HMR
//html
new HtmlWebpackPlugin({
template: 'index.html',
inject: 'body',
filename: 'index.html'
}),
new webpack.NamedModulesPlugin(),
// prints more readable module names in the browser console on HMR updates
],
}