Given that Webpack 5 no longer supports polyfills node modules, the require statement for url is no longer supported in browsers.
Users will see a build error asking to manually resolve the url module.
There are a couple of options for consumers of this library to work around this, one you can manually resolve this using the node-url package and adding this to your webpack config:
resolve: {
fallback: {
url: path.resolve(__dirname, '/node_modules/url/url.js'),
},
},
The other option, in this case is to use the URL class (node, MDN) class to handle parsing of urls, which should work in both web and node environments.
Given that Webpack 5 no longer supports polyfills node modules, the require statement for
urlis no longer supported in browsers.Users will see a build error asking to manually resolve the
urlmodule.There are a couple of options for consumers of this library to work around this, one you can manually resolve this using the node-url package and adding this to your webpack config:
The other option, in this case is to use the URL class (node, MDN) class to handle parsing of urls, which should work in both web and node environments.