FredKSchott / rollup-plugin-polyfill-node

A modern Node.js polyfill for your Rollup bundle.
Other
178 stars 57 forks source link

RollupError: "win32" is not exported by "polyfill-node.path.js" #75

Closed bkuri closed 1 year ago

bkuri commented 1 year ago
[!] RollupError: "win32" is not exported by "polyfill-node.path.js", imported by "node_modules/@rollup/pluginutils/dist/es/index.js".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
node_modules/@rollup/pluginutils/dist/es/index.js (1:18)
1: import { extname, win32, posix, isAbsolute, resolve } from 'path';
                     ^
2: import { walk } from 'estree-walker';
3: import pm from 'picomatch';
    at error (/.../node_modules/rollup/dist/shared/rollup.js:353:30)
    at Module.error (/.../node_modules/rollup/dist/shared/rollup.js:15232:16)
    at Module.traceVariable (/.../node_modules/rollup/dist/shared/rollup.js:15662:29)
    at ModuleScope.findVariable (/.../node_modules/rollup/dist/shared/rollup.js:14109:39)
    at FunctionScope.findVariable (/.../node_modules/rollup/dist/shared/rollup.js:8625:38)
    at ChildScope.findVariable (/.../node_modules/rollup/dist/shared/rollup.js:8625:38)
    at MemberExpression.bind (/.../node_modules/rollup/dist/shared/rollup.js:11033:49)
    at CallExpression.bind (/.../node_modules/rollup/dist/shared/rollup.js:7401:28)
    at CallExpression.bind (/.../node_modules/rollup/dist/shared/rollup.js:11384:15)
    at MemberExpression.bind (/.../node_modules/rollup/dist/shared/rollup.js:7405:23)

Removing the destructuring and using path directly (ie. path.win32.sep) removes the error.

Please let me know if you would like more details :+1:

bkuri commented 1 year ago

I'm closing this since this error apparently went away by itself after updating all packages.

eltaiguer commented 1 year ago

hi @bkuri how did you solve this issue? I'm having the exact same error 🙃

bkuri commented 1 year ago

@eltaiguer at first I had to literally edit index.js to remove the destructuring and add the path. prefix to all previously destructured calls.

So an example I posted previously was to change the import line to import path from 'path' and elements like win32.sep with path.win32.sep.

That being said, this issue went away after either updating or reinstalling all packages (can't say for sure).

Hope it helps!