calvinmetcalf / shapefile-js

Convert a Shapefile to GeoJSON. Not many caveats.
http://calvinmetcalf.github.io/shapefile-js/
714 stars 228 forks source link

global is undefined #186

Open GrayYoung opened 1 year ago

GrayYoung commented 1 year ago

I am using this library in an angular project. After starting the server will throw an error telling "global is undefined". And global doesn't exist in window by default.

Nimazhabu commented 1 year ago
//I'm not familiar with angular , The solution to the vue
//1. npm install buffer
//2.in main.js(Vue) 
import * as buffer from "buffer";

if (typeof (window as any).global === "undefined"){  
   (window as any).global = window;
}
if (typeof (window as any).Buffer === "undefined") { 
   (window as any).Buffer = buffer.Buffer;
}