Skip to content

Commit ea808c9

Browse files
committed
Use vite-plugin-node-polyfills for snaps-utils
1 parent a4c1cc1 commit ea808c9

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

packages/snaps-utils/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@
102102
"validate-npm-package-name": "^5.0.0"
103103
},
104104
"devDependencies": {
105-
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
106-
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
107105
"@lavamoat/allow-scripts": "^3.0.4",
108106
"@metamask/auto-changelog": "^4.1.0",
109107
"@metamask/post-message-stream": "^9.0.0",
@@ -130,6 +128,7 @@
130128
"ts-node": "^10.9.1",
131129
"typescript": "~5.3.3",
132130
"vite": "^6.2.3",
131+
"vite-plugin-node-polyfills": "^0.23.0",
133132
"vite-tsconfig-paths": "^4.0.5",
134133
"vitest": "^3.0.8"
135134
},

packages/snaps-utils/vitest.config.mts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
2-
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
1+
import { nodePolyfills } from 'vite-plugin-node-polyfills';
32
import tsconfigPaths from 'vite-tsconfig-paths';
43
import { defineConfig } from 'vitest/config';
54

65
export default defineConfig({
7-
plugins: [tsconfigPaths()],
8-
9-
optimizeDeps: {
10-
esbuildOptions: {
11-
plugins: [
12-
// @ts-expect-error: Incompatibility between Vite versions.
13-
NodeModulesPolyfillPlugin(),
14-
15-
// @ts-expect-error: Incompatibility between Vite versions.
16-
NodeGlobalsPolyfillPlugin({
17-
buffer: true,
18-
}),
19-
],
20-
},
21-
},
6+
plugins: [tsconfigPaths(), nodePolyfills()],
227

238
test: {
249
// Vitest enables watch mode by default. We disable it here, so it can be

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5887,8 +5887,6 @@ __metadata:
58875887
dependencies:
58885888
"@babel/core": "npm:^7.23.2"
58895889
"@babel/types": "npm:^7.23.0"
5890-
"@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3"
5891-
"@esbuild-plugins/node-modules-polyfill": "npm:^0.2.2"
58925890
"@lavamoat/allow-scripts": "npm:^3.0.4"
58935891
"@metamask/auto-changelog": "npm:^4.1.0"
58945892
"@metamask/base-controller": "npm:^8.0.0"
@@ -5936,6 +5934,7 @@ __metadata:
59365934
typescript: "npm:~5.3.3"
59375935
validate-npm-package-name: "npm:^5.0.0"
59385936
vite: "npm:^6.2.3"
5937+
vite-plugin-node-polyfills: "npm:^0.23.0"
59395938
vite-tsconfig-paths: "npm:^4.0.5"
59405939
vitest: "npm:^3.0.8"
59415940
languageName: unknown

0 commit comments

Comments
 (0)