Skip to content

Missing module 'url' #743

@Shepard

Description

@Shepard

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 eb9d0bc 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions