rubensworks/sparqljson-parse.js

Issues with Webpack 5

Closed this issue · 1 comments

Hi,

First of all: thank you for making this package and the whole ecosystem of JS libraries for RDF!

Just wanted to share that using sparqljson-parse with Webpack 5 in client-side code needed a few adjustments in terms of dependencies.

I had to install stream-browserify and buffer and add them in https://webpack.js.org/configuration/resolve/#resolvefallback

        fallback: {
            'stream': require.resolve('stream-browserify'),
            'buffer': require.resolve('buffer'),
        }

A possible way to reproduce the issue is this repository https://github.com/Wanderduene/quickstart-webpack

The issue is not relate so much to the sparqljson-parse package, but the fact that webpack 5 does no longer include a polyfill for this Node.js variables so using the package in front-end code won't work.

Indeed, that's correct. For webpack 5 you'll need Node.js polyfills. I often just use this one: https://www.npmjs.com/package/node-polyfill-webpack-plugin