Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

homeDir not exported by "os" #37

Open
t-lock opened this issue May 31, 2022 · 3 comments
Open

homeDir not exported by "os" #37

t-lock opened this issue May 31, 2022 · 3 comments

Comments

@t-lock
Copy link

t-lock commented May 31, 2022

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, 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?

@busterbogheart
Copy link

@t-lock Did you make any progress with this?

@nileshtrivedi
Copy link

Adding this to polyfills/os.js worked for me:

export function homedir() {
	return '/';
}

@Afrin127329
Copy link

Any other solution? I tried with polyfills/os.js but didn't work in my case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants