Skip to content

Commit 2d9c8fe

Browse files
Update index.ts
When I run `yarn build`, I have the error: ``` [vite]: Rollup failed to resolve import "Buffer" from "../../node_modules/loupe/loupe.js". ``` I applied the instructions from the doc from node-stdlib-browser, and this fixed the issues.
1 parent 5240c17 commit 2d9c8fe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ export const nodePolyfills = (options: Partial<PolyfillOptions> = {}): Plugin =>
6464
plugins: [
6565
{
6666
...inject({
67-
Buffer: 'Buffer',
68-
global: 'global',
69-
process: 'process',
67+
// cf. https://github.com/niksy/node-stdlib-browser/blob/3e7cd7f3d115ac5c4593b550e7d8c4a82a0d4ac4/README.md#vite
68+
global: [globalShims, 'global'],
69+
process: [globalShims, 'process'],
70+
Buffer: [globalShims, 'Buffer']
7071
}),
7172
},
7273
],

0 commit comments

Comments
 (0)