Vega and Webpack - nyurik/vega GitHub Wiki

This wiki documents Vega version 2. For Vega 3 documentation, see vega.github.io/vega.

The following configuration needs to be used to get webpack working with vega. Be sure to be using vega-scenegraph 1.0.15 or higher.

package.json devDependencies

You'll need to add the following dependencies to your package.json file (as of vega 2.3.1):

"browserify-versionify": "^1.0.6",
"jstransform": "^11.0.2",
"through": "^2.3.8",
"transform-loader": "^0.2.3"

Note that browserify-versionify is optional if you do not care about having the vega version available on the vega object.

webpack.config.js

You need the following loaders specified for vega (as of vega 2.3.1):

module: {
  loaders: [
    {
      test: require.resolve('vega'),
      loaders: [
        'transform?vega/scripts/strip-schema.js',
        'transform?browserify-versionify'
      ]
    },
  ]
}

Again, if you do not care about the vega version being available on the vega object, you can omit the browserify-versionify line.