File tree 3 files changed +636
-52
lines changed
encryption-decryption/browser
3 files changed +636
-52
lines changed Original file line number Diff line number Diff line change 20
20
"@vitejs/plugin-react-swc" : " ^3.7.0" ,
21
21
"ethers" : " v5" ,
22
22
"react" : " ^18.3.1" ,
23
- "react-dom" : " ^18.3.1"
23
+ "react-dom" : " ^18.3.1" ,
24
+ "rollup-plugin-polyfill-node" : " ^0.13.0" ,
25
+ "vite-plugin-node-polyfills" : " ^0.22.0"
24
26
},
25
27
"devDependencies" : {
26
28
"@types/react" : " ^18.3.3" ,
Original file line number Diff line number Diff line change 1
- import { defineConfig } from "vite" ;
2
- import react from "@vitejs/plugin-react-swc" ;
3
- import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill" ;
4
- import { NodeModulesPolyfillPlugin } from "@esbuild-plugins/node-modules-polyfill" ;
1
+ import { defineConfig } from 'vite' ;
2
+ import react from '@vitejs/plugin-react' ;
3
+ import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill' ;
4
+ import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill' ;
5
+ import rollupNodePolyFill from 'rollup-plugin-polyfill-node' ;
6
+ import { nodePolyfills } from 'vite-plugin-node-polyfills' ;
5
7
6
8
export default defineConfig ( {
7
- plugins : [ react ( ) ] ,
9
+ plugins : [
10
+ react ( ) ,
11
+ nodePolyfills ( {
12
+ include : [ 'buffer' , 'process' , 'util' ]
13
+ } ) ,
14
+ ] ,
8
15
define : {
9
- global : "window" ,
16
+ 'process.env' : { } ,
17
+ global : 'globalThis' ,
18
+ } ,
19
+ resolve : {
20
+ alias : {
21
+ // Remove the buffer alias
22
+ } ,
23
+ } ,
24
+ optimizeDeps : {
25
+ esbuildOptions : {
26
+ define : {
27
+ global : 'globalThis' ,
28
+ } ,
29
+ plugins : [
30
+ NodeGlobalsPolyfillPlugin ( {
31
+ buffer : true ,
32
+ process : true
33
+ } ) ,
34
+ NodeModulesPolyfillPlugin ( ) ,
35
+ ] ,
36
+ } ,
37
+ } ,
38
+ build : {
39
+ rollupOptions : {
40
+ plugins : [
41
+ rollupNodePolyFill ( ) ,
42
+ ] ,
43
+ } ,
10
44
} ,
11
- optimizeDeps : {
12
- esbuildOptions : {
13
- // Node.js global to browser globalThis
14
- define : {
15
- global : "globalThis" ,
16
- } ,
17
- // Enable esbuild polyfill plugins
18
- plugins : [
19
- NodeGlobalsPolyfillPlugin ( {
20
- process : true ,
21
- buffer : true ,
22
- } ) ,
23
- NodeModulesPolyfillPlugin ( ) ,
24
- ] ,
25
- } ,
26
- } ,
27
45
} ) ;
You can’t perform that action at this time.
0 commit comments