Skip to content

Instantly share code, notes, and snippets.

@jefffriesen
Last active December 1, 2016 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefffriesen/76e370bd5031c982f8aae7606fa21788 to your computer and use it in GitHub Desktop.
Save jefffriesen/76e370bd5031c982f8aae7606fa21788 to your computer and use it in GitHub Desktop.
Webpack config for deck.gl (working for react-map-gl)
/* eslint strict: 0 */
'use strict';
const webpack = require('webpack')
const path = require('path')
// Attempt at getting deck.gl working with webpack. See https://github.com/uber/deck.gl/issues/247
// This works for react-map-gl but not deck.gl.
module.exports = {
module: {
noParse: /node_modules\/mapbox-gl\/dist\/mapbox-gl.js/,
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader'],
exclude: /node_modules/
}, {
test: /\.json$/,
loader: 'json-loader'
}
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['', '.js', '.jsx'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
alias: {
'crossfilter': 'crossfilter2',
'mapbox-gl/js/geo/transform': path.join(__dirname, "/node_modules/mapbox-gl/js/geo/transform"),
'mapbox-gl': path.join(__dirname, "/node_modules/mapbox-gl/dist/mapbox-gl.js")
}
},
plugins: [
// Don't load the huge moment locale translations
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
node: {
"canvas": "empty",
"jsdom": "empty"
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment