calvinmetcalf / shapefile-js

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

Unable to use with Webpack 5 #148

Closed 3zzy closed 2 years ago

3zzy commented 3 years ago

Webpack 5 doesn't include node polyfills anymore so I'm having issues using the library.

Error: nodebuffer is not supported by this browser

error

I already tried this in my Webpack config:

resolve: {
    fallback: {
        fs: false,
        path: require.resolve("path-browserify"),
        buffer: require.resolve("buffer")
    }
}

and even setting these to false but no luck.

3zzy commented 3 years ago

So I installed the node-polyfill-webpack-plugin and now there's a different error:

TypeError: r.isBuffer is not a function

error

calvinmetcalf commented 3 years ago

any chance you can show non minified stack trace ?

3zzy commented 3 years ago

@calvinmetcalf Sure

Screen Shot 2020-12-24 at 11 56 14 am

error

calvinmetcalf commented 3 years ago

this comment suggests you may have to do

new webpack.ProvidePlugin({
  Buffer: ['buffer', 'Buffer'],
})