SoftwareBrothers / adminjs

AdminJS is an admin panel for apps written in node.js
https://adminjs.co
MIT License
8.06k stars 644 forks source link

[Bug]: @adminjs/bundler is overwriting NODE_ENV #1679

Open AshotN opened 1 week ago

AshotN commented 1 week ago

Contact Details

No response

What happened?

If you import @adminjs/bundler

Your NODE_ENV gets set to production.

What is the point of that?

Bug prevalence

Always

AdminJS dependencies version

@adminjs/bundler v3.0.0

What browsers do you see the problem on?

No response

Relevant log output

No response

Relevant code that's giving you issues

https://github.com/SoftwareBrothers/adminjs-bundler/blob/main/src/bundle.ts#L6
dziraf commented 1 week ago

There's no reason to use @adminjs/bundler locally but every AdminJS panel hosted remotely must have NODE_ENV set to production to bundle/serve minified files. It's set explicitly to production because there were lots of questions why people's admin panels load slowly in production or weigh over 50 MBs.

AshotN commented 5 days ago

I have a staging environment, which acts the same as prod for most things. In that situation @adminjs/bundler changes my NODE_ENV and causes issues.

It shouldn't be a packages responsibility for the user to set the correct NODE_ENV. Nor should a package overwrite process.env