You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-2Lines changed: 50 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
A Vite plugin to polyfill Node's Core Modules for browser environments. Supports [`node:` protocol imports](https://nodejs.org/dist/latest-v16.x/docs/api/esm.html#node-imports).
4
4
5
-
###Why do I need this?
5
+
## Why do I need this?
6
6
7
7
```
8
8
Module "stream" has been externalized for browser compatibility. Cannot access "stream.Readable" in client code.
@@ -35,7 +35,9 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills'
35
35
exportdefaultdefineConfig({
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,49 @@ export default defineConfig({
51
53
],
52
54
})
53
55
```
56
+
57
+
### All polyfills
58
+
59
+
- If protocolImports is true, also adds node:[module]
0 commit comments