Skip to content

Commit 5564be5

Browse files
committed
Add support for subpath polyfills
1 parent 67df411 commit 5564be5

File tree

5 files changed

+195
-117
lines changed

5 files changed

+195
-117
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ export default defineConfig({
6969
// Override the default polyfills for specific modules.
7070
overrides: {
7171
// Since `fs` is not supported in browsers, we can use the `memfs` package to polyfill it.
72-
fs: 'memfs',
72+
'fs': 'memfs',
73+
// Subpaths can be specified as well.
74+
'path/posix': 'path-browserify',
7375
},
7476
// Whether to polyfill `node:` protocol imports.
7577
protocolImports: true,

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,11 @@
8585
},
8686
"dependencies": {
8787
"@rollup/plugin-inject": "^5.0.5",
88+
"browser-resolve": "^2.0.0",
8889
"node-stdlib-browser": "^1.2.0"
8990
},
9091
"devDependencies": {
92+
"@types/browser-resolve": "^2.0.4",
9193
"@types/node": "^18.18.8",
9294
"buffer": "6.0.3",
9395
"esbuild": "^0.19.8",

0 commit comments

Comments
 (0)