parser icon indicating copy to clipboard operation
parser copied to clipboard

Missing module 'url'

Open Shepard opened this issue 1 year ago • 0 comments

I use the parser in a vue-cli project and I tried updating from @postlight/mercury-parser 2.2.1 to @postlight/parser 2.2.3. When I run my project, I get the following error.

 ERROR  Failed to compile with 1 error                                                                                                                                                                                                                                              12:07:40

 error  in ./node_modules/@postlight/parser/dist/mercury.js

Module not found: Error: Can't resolve 'url' in '[...]\node_modules\@postlight\parser\dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
        - install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "url": false }

In commit eb9d0bc5e8b32598ad07bd3e9ba704a27b458163 the dependency 'url' was removed. This change was first released in 2.2.2 so I assume it's responsible for this error I'm getting.

Adding the 'url' dependency to my project fixes the issue. And it doesn't add any vulnerabilities either (when I run yarn audit).

Was there any particular reason to remove this dependency? What could be different about my environment that I'm getting this error and you (presumably) don't?

Shepard avatar May 04 '23 10:05 Shepard