davidmyersdev/vite-plugin-node-polyfills

warning Pattern ["buffer@^6.0.3"] is trying to unpack in the same destination

nflaig opened this issue · 2 comments

nflaig commented

Getting the following warning due to using this package

warning Pattern ["buffer@^6.0.3"] is trying to unpack in the same destination "/home/<user>/.cache/yarn/v6/npm-buffer-polyfill-6.0.3-2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6-integrity/node_modules/buffer-polyfill" as pattern ["buffer-polyfill@npm:buffer@^6.0.3"]. This could result in non-deterministic behavior, skipping.

likely related to

"buffer-polyfill": "npm:buffer@^6.0.3",

nflaig commented

Did some digging into the history of this package, looks like there was a similar issue with process-polyfill

// We cannot use `process-polyfill` as the package name due to a bug in Yarn v1. The errors results in a dependency
// conflict with `node-stdlib-browser` which fails to import `process/browser.js`.
// https://github.com/yarnpkg/yarn/issues/6907
// eslint-disable-next-line unicorn/prefer-node-protocol
export { default as process } from 'process'

Although I don't know if there is an actual runtime issue due to the buffer warning.

Potential workaround to get rid of the warning is to add custom resolution to install to different versions of buffer package, the only updates in 6.0.3 are type related (feross/buffer#277) so I don't expect problems

"resolutions": {
    "buffer-polyfill": "npm:buffer@6.0.2"
  }

I am still curious, I haven't seen this before. Why is the renaming of the buffer package to buffer-polyfill required?

"dependencies": {
    "buffer-polyfill": "npm:buffer@^6.0.3",
  }
nflaig commented

Thanks @davidmyersdev for addressing this so quickly. We have updated the plugin to latest version and all warnings are resolved 🎉