[PR #1804] [CLOSED] fix: pass NODE_ENV to the client side of remix application to load language files #1860

Closed
opened 2026-02-26 20:31:23 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/1804
Author: @divyaswormakai
Created: 5/20/2025
Status: Closed

Base: mainHead: fix/issue-1761-app-not-working-on-local


📝 Commits (5)

  • 91667e4 fix: pass NODE_ENV to the client side of remix application to load translation properly
  • 3be169c Merge branch 'main' into fix/issue-1761-app-not-working-on-local
  • 5b88122 Merge branch 'main' into fix/issue-1761-app-not-working-on-local
  • d390c78 Merge branch 'main' into fix/issue-1761-app-not-working-on-local
  • c25ac51 Merge branch 'main' into fix/issue-1761-app-not-working-on-local

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 apps/remix/app/root.tsx (+1 -1)

📄 Description


name: pass NODE_ENV to the client side of remix application to load language files

Description

When running the application in development through the guidelines, the app doesn't load correctly with an error on the console saying:

image

This is fine when we run

npm run d

But for manual installation and installation with npm run dx we see this issue and below explains what is happening:
In development mode, the i18n translation files search for .po extension files. However due to the NODE_ENV not being set to development in client side of the application(not being properly passed in the env), the translation files default to .mjs files.
But we have not yet compiled the language files and we don't have any .mjs files yet. Thus the application throws an error and nothing works.

Fixes #1761

Changes Made

  • Adds NODE_ENV on the client side of the remix application when app is initialized

Testing Performed

Before the changes:

  • Tested the application with npm run d: Works as expected
  • Tested the application with npm run dx followed by npm run dev: Issue is seen
  • Tested the application with manual installation steps: Issue is seen

After the changes:

  • Tested the application with npm run dx followed by npm run dev: Issue is resolved
  • Tested the application with manual installation steps: Issue is resolved

Checklist

  • I have tested these changes locally and they work as expected.
  • [x ] I have followed the project's coding style guidelines.

Additional Notes

There are other ways of making this work.

  • Option 1:
    Setting NEXT_PUBLIC_NODE_ENV on the .env file, which exposes a new key to the client side.

  • Option 2:
    Checking for condition NODE_ENV==='production' instead of development in all the places.

Among the alternatives, I believe the current implementation makes more sense, because if there ever is another environment setting that needs to be called out on the development, it will be accessible on the client side as well.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/1804 **Author:** [@divyaswormakai](https://github.com/divyaswormakai) **Created:** 5/20/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-1761-app-not-working-on-local` --- ### 📝 Commits (5) - [`91667e4`](https://github.com/documenso/documenso/commit/91667e41ebb0754f3177d85cefec00c4da9ddecd) fix: pass NODE_ENV to the client side of remix application to load translation properly - [`3be169c`](https://github.com/documenso/documenso/commit/3be169c54daf8ec6dae88e8ad32d473ae662b302) Merge branch 'main' into fix/issue-1761-app-not-working-on-local - [`5b88122`](https://github.com/documenso/documenso/commit/5b88122980251331bb8e07a10fbd0d38d85f63f0) Merge branch 'main' into fix/issue-1761-app-not-working-on-local - [`d390c78`](https://github.com/documenso/documenso/commit/d390c78864ea9b60f8cf2e3d3a9e0eb8a8675aa6) Merge branch 'main' into fix/issue-1761-app-not-working-on-local - [`c25ac51`](https://github.com/documenso/documenso/commit/c25ac511e1ee6e42b6f1c3fcb7d14aebb5afae35) Merge branch 'main' into fix/issue-1761-app-not-working-on-local ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `apps/remix/app/root.tsx` (+1 -1) </details> ### 📄 Description --- name: pass NODE_ENV to the client side of remix application to load language files --- ## Description <!--- Describe the changes introduced by this pull request. --> <!--- Explain what problem it solves or what feature/fix it adds. --> When running the application in development through the [guidelines](https://github.com/documenso/documenso?tab=readme-ov-file#developer-quickstart), the app doesn't load correctly with an error on the console saying: ![image](https://github.com/user-attachments/assets/38fe08f7-6496-4c7a-bbc2-e83aef5d0f2c) This is fine when we run ``` npm run d ``` But for manual installation and installation with `npm run dx` we see this issue and below explains what is happening: In development mode, the i18n translation files search for `.po` extension files. However due to the `NODE_ENV` not being set to `development` in client side of the application(not being properly passed in the env), the translation files default to `.mjs` files. But we have not yet compiled the language files and we don't have any `.mjs` files yet. Thus the application throws an error and nothing works. ## Related Issue Fixes #1761 ## Changes Made - Adds `NODE_ENV` on the client side of the remix application when app is initialized ## Testing Performed **Before the changes:** - Tested the application with `npm run d`: Works as expected - Tested the application with `npm run dx` followed by `npm run dev`: Issue is seen - Tested the application with manual installation steps: Issue is seen **After the changes:** - Tested the application with `npm run dx` followed by `npm run dev`: Issue is resolved - Tested the application with manual installation steps: Issue is resolved ## Checklist <!--- Please check the boxes that apply to this pull request. --> <!--- You can add or remove items as needed. --> - [x] I have tested these changes locally and they work as expected. - [x ] I have followed the project's coding style guidelines. ## Additional Notes There are other ways of making this work. - Option 1: Setting `NEXT_PUBLIC_NODE_ENV` on the .env file, which exposes a new key to the client side. - Option 2: Checking for condition `NODE_ENV==='production'` instead of development in all the places. Among the alternatives, I believe the current implementation makes more sense, because if there ever is another environment setting that needs to be called out on the development, it will be accessible on the client side as well. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 20:31:23 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#1860
No description provided.