Esri / arcgis-webpack-plugin

Webpack plugin for the ArcGIS API for JavaScript
Apache License 2.0
134 stars 26 forks source link

4.14: Cannot display geoJSON in non mercator projected coordinate system #79

Closed Biboba closed 4 years ago

Biboba commented 4 years ago

I just upgraded from 4.13 to 4.14 and noticed that my geoJSON file is not displayed any more and the following error is logged:

ReferenceError: global is not defined

Capture d’écran 2020-02-19 à 16 55 40

Description

I am trying to display a geoJson layer on a non-mercator projected coordinate system.

Expected Behavior

GeoJSON layer should be displayed.

Actual Behavior

GeoJSON layer is not displayed and an error is logged.

Possible Fix

The same sample works fine with js api from CDN so it is related to webpack

Steps to Reproduce

  1. use arcgis-js-cli to init an application: arcgis create my-application
  2. Update index.ts file using a basemap in a non-mercator coordinate system and a geojson layer
  3. run npm start

Context

Adding a geoJSON layer to a non mercator projected coordinate system.

Your Environment

Biboba commented 4 years ago

I made a repo: https://github.com/Biboba/geojson-bug-4-14 With the same data from CDN it works: https://codepen.io/sdksds/pen/dyopGej

odoe commented 4 years ago

You can fix this by adding an option to the webpack.config.js node section.

    node: {
      process: false,
      global: false,
      Buffer: false, // ADD THIS
      fs: 'empty',
    },

This will fix it. I'll update the template apps for the next release. Thanks!

Biboba commented 4 years ago

Indeed, it works fine now. Many thanks for the quick fix !