ionic-team / ionic-team/rollup-plugin-node-polyfills

homeDir not exported by "os"

Offen
#37 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
142
Forks
65
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hello,

Thanks for your work on this excellent and critical piece of OSS.

I am experiencing an issue trying to polyfill the node os module in a Vite build that bundles some pieces of the AWS javascript SDK v3 with my application. Specifically, AWS is trying to import `homeDir` from "os", which is a part of the node module [here](https://nodejs.dev/learn/the-nodejs-os-module/#oshomedir), but is not exported by `rollup-plugin-node-polyfills/polyfills/os.js`

```
Error: 'homedir' is not exported by node_modules/rollup-plugin-node-polyfills/polyfills/os.js, imported by node_modules/@aws-sdk/credential-providers/node_modules/@aws-sdk/shared-ini-file-loader/dist-es/getHomeDir.js
```

As far as I can tell, it makes no sense to want a "homeDir" in the browser, so this may be an issue that should be raised with the AWS team. However, since it _is_ an export on the node module, I think that some form of support, such as defaulting to the project root, or a configurable option to set the dist or public folder may be in order.

What do you think?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start with polyfills/os.js and the failing import from @aws-sdk/shared-ini-file-loader/dist-es/getHomeDir.js. Confirm how the polyfill should handle Node's os.homedir export in a browser build, since the issue proposes several possible behaviors without choosing one. Done means the agreed behavior is supported and the reported Vite/Rollup import error no longer occurs.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript
Bereich
build-system, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.