Skip to content

Commit f52db14

Browse files
author
Letícia
committed
docs: update README with new include option and all polyfills
1 parent ac1efc9 commit f52db14

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'
3535
export default defineConfig({
3636
plugins: [
3737
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
3941
exclude: [
4042
'fs', // Excludes the polyfill for `fs` and `node:fs`.
4143
],
@@ -51,3 +53,48 @@ export default defineConfig({
5153
],
5254
})
5355
```
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

src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ export const nodePolyfills = (options: PolyfillOptions = {}): Plugin => {
171171
return included
172172
}, {} as Record<ModuleName, string>)
173173

174-
console.log({ ArrayNames: Object.keys(polyfills) });
175-
176174
return {
177175
build: {
178176
rollupOptions: {

test/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default defineConfig({
1010
// react(),
1111
vue(),
1212
nodePolyfills({
13+
// include: ['fs', 'path', 'buffer'],
1314
exclude: ['fs'],
1415
globals: {
1516
process: 'build',

0 commit comments

Comments
 (0)