vite-plugin-node-polyfills
vite-plugin-node-polyfills copied to clipboard
Fix globals are always defined
Fixes #86
@davidmyersdev I've fixed linter errors. The only remaining error is in e2e test (examples/vanilla). I'm not sure how to fix it correctly. In this test you've configured the plugin to define process only in build mode, but test expects it to be defined in both modes (lines 51 for process and 52 for process.env).
https://github.com/davidmyersdev/vite-plugin-node-polyfills/blob/29e3c8256011e02434283919374d0f0beab9c05b/examples/vanilla/vite.config.ts#L12-L14
https://github.com/davidmyersdev/vite-plugin-node-polyfills/blob/29e3c8256011e02434283919374d0f0beab9c05b/examples/vanilla/test/e2e/main.spec.ts#L43-L60
Currently, test:e2e:build runs without errors, while test:e2e:dev fails with process is not defined error, which is the expected behaviour in my opinion.
@Ilyat1337 It looks like that error is actually being raised by the fs module due to its reliance on process. I'll have to split those tests up.