davidmyersdev / vite-plugin-node-polyfills

A Vite plugin to polyfill Node's Core Modules for browser environments.
MIT License
301 stars 22 forks source link

Plugin does not work with sentry plugin #26

Closed janhmeyer closed 1 year ago

janhmeyer commented 1 year ago

Hello,

I hat an issue get this plugin working with a sentry vite plugin, as described here: https://github.com/rollup/rollup-plugin-commonjs/pull/327

I did the following

Environment Linux with Node 18

Steps to Reproduce Install nuxt 3 base Use vite Use vite plugin with vite-plugin-node-polyfills Use sentry Plugin "nuxt build" fails Does not happen, when using polyfills or sentry separately.

Expected Result build success

Actual Result ERROR "sentry-release-injection-file" is imported as an external by "browserify-sign/algos.js?commonjs-external", but is already an existing non-external module id. 16:08:04

ERROR "sentry-release-injection-file" is imported as an external by "browserify-sign/algos.js?commonjs-external", but is already an existing non-external module id. 16:08:04

at error (node_modules/.pnpm/rollup@3.26.2/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)

As stated in the answer, sentry advised to take a look at https://github.com/rollup/rollup-plugin-commonjs/pull/327 which provides a similar solution which may fit in for vite-plugin-node-polyfills as well.

davidmyersdev commented 1 year ago

Hey @janhmeyer. I'd be happy to look into this if you can provide an example reproduction with either CodeSandbox or StackBlitz.

davidmyersdev commented 1 year ago

Closing this until a reproduction is added.