Skip to content

Add support for .env files #6

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

Closed
pepelsbey opened this issue Mar 20, 2025 · 4 comments
Closed

Add support for .env files #6

pepelsbey opened this issue Mar 20, 2025 · 4 comments
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.

Comments

@pepelsbey
Copy link
Member

Otherwise, you need to explicitly set your variables when starting the backend:

CONTENT_ROOT=../content/files npm run rari serve

Something similar to what we have in content: env-cmd + cross-env, I guess.

I’d also recommend adding a sample file with the most likely content location pre-filled, so you can copy and rename it to make it work in seconds.

@mdn-bot mdn-bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Mar 20, 2025
@chenjiahan
Copy link

I'm excited to see that MDN is using Rsbuild! The Rspack team would be more than happy to provide support for MDN.

Regarding loading env variables, I'd like to mention that Rsbuild offers a convenient way to load .env files. For example, you can simply enable env loading with:

const rsbuild = await createRsbuild({
  loadEnv: true
});

See our documentation for more details.

@LeoMcA
Copy link
Member

LeoMcA commented Mar 26, 2025

Hi @chenjiahan, thanks for reaching out!

Interestingly, I've been considering migrating from rsbuild to rspack, as we've been burned by "batteries included" build tools in the past (when we want to change those batteries!), it would be great to get your thoughts on an issue I've started for that over here: #15

@chenjiahan
Copy link

it would be great to get your thoughts on an issue I've started for that over here: #15

Sure thing, my reply is at #15 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened.
Projects
None yet
Development

No branches or pull requests

4 participants