[BUG] Error when bundling with Vite: Rollup failed to resolve import "#node-web-compat"
Fitzpasd opened this issue · 3 comments
Fitzpasd commented
Describe the bug
The below error is thrown when trying to use this in an application that is bundled with Vite:
[vite]: Rollup failed to resolve import "#node-web-compat" from .....
Versions
3.4.0
To Reproduce
Here is a StackBlitz which shows the issue. Run npm run build
in the console there and it will fail.
hakanson commented
I was able to compile with this vite.config.ts
(and after a npm install @rollup/plugin-node-resolve
)
import { defineConfig } from 'vite';
import resolve from '@rollup/plugin-node-resolve';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [resolve({ browser: true })],
});
see https://stackblitz.com/edit/vitejs-vite-cpfuqa?file=vite.config.ts
Fitzpasd commented
I landed on something similar:
export default defineConfig({
plugins: [resolve({ resolveOnly: ['aws-jwt-verify'] })],
});
For now I'm not going to switch everything over to node resolve.