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

Could not resolve "path", could not resolve "os" #3799

Open
markskayff opened this issue Jun 12, 2024 · 3 comments
Open

Could not resolve "path", could not resolve "os" #3799

markskayff opened this issue Jun 12, 2024 · 3 comments

Comments

@markskayff
Copy link

When trying to build a react project doing: npm run build-dev
I get a lot of Could not resolve "path" Could not resolve "os" Could not resolve "crypto"

And of course the build fails. I'm building for the browser.

I have to note I'm using this plugin:

const envFilePlugin = require('esbuild-envfile-plugin');

could-not-resolve

@evanw
Copy link
Owner

evanw commented Jun 12, 2024

The browser does not provide packages such as os, so these packages are not available when building for the browser. If you want to substitute them for other ones, you should be able to use either the alias feature or a plugin for that.

@hyrious
Copy link

hyrious commented Jun 12, 2024

That plugin (and most esbuild plugins) are meant to run in the Node.js runtime. While your error message seems that you're bundling that plugin into your browser bundle, which is incorrect.

@markskayff
Copy link
Author

That plugin (and most esbuild plugins) are meant to run in the Node.js runtime. While your error message seems that you're bundling that plugin into your browser bundle, which is incorrect.

Definitely I'm building for the browser here. But the odd part is this, it's a project I'm resuming from 1 year, which it was working ok, and now trying to re-build it, and it's complaining with this. That's odd.

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

3 participants