Skip to content

Commit 010fc94

Browse files
Add fs null fallback (#45)
* feat: add `fs` fallback * Update readme.md * Stop polyfilling `console`, 'domain', `process`, and internal `stream` modules by default; rename `includeAliases` to `additionalAliases`, and allow ignoring the defaults with `onlyAliases` Fixes #40, fixes #52, fixes #18, fixes #44 Signed-off-by: Richie Bendall <[email protected]> * Add as default Signed-off-by: Richie Bendall <[email protected]> * Update readme.md --------- Signed-off-by: Richie Bendall <[email protected]> Co-authored-by: Richie Bendall <[email protected]>
1 parent 08f793b commit 010fc94

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ declare namespace NodePolyfillPlugin {
1111
| 'crypto'
1212
| 'domain'
1313
| 'events'
14+
| 'fs'
1415
| 'http'
1516
| 'https'
1617
| 'os'

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const defaultPolyfills = new Set([
2727
'constants',
2828
'crypto',
2929
'events',
30+
'fs',
3031
'http',
3132
'https',
3233
'os',
@@ -107,6 +108,7 @@ module.exports = class NodePolyfillPlugin {
107108
crypto: require.resolve('crypto-browserify'),
108109
domain: require.resolve('domain-browser'),
109110
events: require.resolve('events/'),
111+
fs: false,
110112
http: require.resolve('stream-http'),
111113
https: require.resolve('https-browserify'),
112114
os: require.resolve('os-browserify/browser'),

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ module.exports = {
4040
};
4141
```
4242

43+
The `fs` module resolves to nothing because its functionality cannot replicated in the browser.
44+
4345
## API
4446

4547
### new NodePolyfillPlugin(options?)

0 commit comments

Comments
 (0)