File tree Expand file tree Collapse file tree 3 files changed +49
-3
lines changed Expand file tree Collapse file tree 3 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'
35
35
export default defineConfig ({
36
36
plugins: [
37
37
nodePolyfills ({
38
- // To exclude specific polyfills, add them to this list.
38
+ // To add only specific polyfills, add them here. If no option is passed, adds all polyfills
39
+ include: [' path' ]
40
+ // To exclude specific polyfills, add them to this list. Note: if include is provided, this has no effect
39
41
exclude : [
40
42
' fs' , // Excludes the polyfill for `fs` and `node:fs`.
41
43
],
@@ -51,3 +53,48 @@ export default defineConfig({
51
53
],
52
54
})
53
55
```
56
+
57
+ ### All polyfills
58
+
59
+ 'assert',
60
+ 'buffer',
61
+ 'child_process',
62
+ 'cluster',
63
+ 'console',
64
+ 'constants',
65
+ 'crypto',
66
+ 'dgram',
67
+ 'dns',
68
+ 'domain',
69
+ 'events',
70
+ 'fs',
71
+ 'http',
72
+ 'https',
73
+ 'http2',
74
+ 'module',
75
+ 'net',
76
+ 'os',
77
+ 'path',
78
+ 'punycode',
79
+ 'process',
80
+ 'querystring',
81
+ 'readline',
82
+ 'repl',
83
+ 'stream',
84
+ '_stream_duplex',
85
+ '_stream_passthrough',
86
+ '_stream_readable',
87
+ '_stream_transform',
88
+ '_stream_writable',
89
+ 'string_decoder',
90
+ 'sys',
91
+ 'timers/promises',
92
+ 'timers',
93
+ 'tls',
94
+ 'tty',
95
+ 'url',
96
+ 'util',
97
+ 'vm',
98
+ 'zlib',
99
+
100
+ plus the node:[lib] if protocolImports is true
Original file line number Diff line number Diff line change @@ -171,8 +171,6 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
171
171
return included
172
172
} , { } as Record < ModuleName , string > )
173
173
174
- console . log ( { ArrayNames : Object . keys ( polyfills ) } ) ;
175
-
176
174
return {
177
175
build : {
178
176
rollupOptions : {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export default defineConfig({
10
10
// react(),
11
11
vue ( ) ,
12
12
nodePolyfills ( {
13
+ // include: ['fs', 'path', 'buffer'],
13
14
exclude : [ 'fs' ] ,
14
15
globals : {
15
16
process : 'build' ,
You can’t perform that action at this time.
0 commit comments