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

2.0 Error: Dynamic require of "fs" is not supported #824

Open
JoshuaGerke opened this issue May 6, 2024 · 1 comment
Open

2.0 Error: Dynamic require of "fs" is not supported #824

JoshuaGerke opened this issue May 6, 2024 · 1 comment

Comments

@JoshuaGerke
Copy link

Error on using JS Module v2 and Dotenv

import 'dotenv/config';

[22:18:45][Error] Error: Dynamic require of "fs" is not supported
at file:///C:/Users/Comma/Documents/ProjectReborn/server/altv/resources/gamemode/server/startup.js:39:9
at node_modules/dotenv/lib/main.js (file:///C:/Users/Comma/Documents/ProjectReborn/server/altv/resources/gamemode/server/startup.js:119:15)
at __require2 (file:///C:/Users/Comma/Documents/ProjectReborn/server/altv/resources/gamemode/server/startup.js:42:50)
at file:///C:/Users/Comma/Documents/ProjectReborn/server/altv/resources/gamemode/server/startup.js:424:3
at file:///C:/Users/Comma/Documents/ProjectReborn/server/altv/resources/gamemode/server/startup.js:431:3

@motdotla
Copy link
Owner

motdotla commented Dec 3, 2024

if you are using dotenvx in an es module environment, shouldn't you be loading it as the following?

import dotenv from 'dotenv';
dotenv.config();

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

2 participants