FredKSchott / FredKSchott/rollup-plugin-polyfill-node

Error: 'fileURLToPath' is not exported by polyfill-node.url.js

Open
#49 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
193
Forks
60
PR merge metrics
No merged PRs in 30d

Description

I'm using 0.9.0 and seeing this error when I bundle.

If I put `nodePolyfills()` first in my plug-ins array in config I get this error

```
[!] Error: 'fileURLToPath' is not exported by polyfill-node.url.js, imported by ../
../node_modules/vfile/lib/minurl.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
../../node_modules/vfile/lib/minurl.js (1:8)
1: export {fileURLToPath as urlToPath} from 'url'
^
2: export {isUrl} from './minurl.shared.js'
Error: 'fileURLToPath' is not exported by polyfill-node.url.js, imported by ../../n
ode_modules/vfile/lib/minurl.js

...

```

if I put it after node-resolve etc, I get an error that node shims aren't installed.

All this is accurate. fileURLToPath Is indeed not exported by that module. And yet I don't understand! 😀

what am I doing wrong?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with vfile/lib/minurl.js and inspect the corresponding polyfill-node.url.js export, then compare the plugin order described in the issue with the Rollup configuration. Reproduce the 0.9.0 bundle failure and identify a configuration or export behavior that makes fileURLToPath resolve correctly without losing the Node shims.

Written by the indexing model from the issue text.

Assessment

Tech stack
rollup, typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.