Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not Supported in Webpack 5 #22

Open
alettieri opened this issue Apr 28, 2021 · 2 comments
Open

Not Supported in Webpack 5 #22

alettieri opened this issue Apr 28, 2021 · 2 comments

Comments

@alettieri
Copy link

alettieri commented Apr 28, 2021

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.

@niemyjski
Copy link

Would be great to support esm modules as well.

@niemyjski
Copy link

niemyjski commented Jul 20, 2022

Perhaps merge in changes from: https://github.com/web3-storage/parse-link-header @alanshaw any chance you could do a pr?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants