Skip to content

Appear to be getting 2 instances of globals - one in the remix serverside code (action, loader) & one in the server.js hosting code. Does that make sense? #9790

Answered by gustavopch
Nick-Minutello asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, unfortunately, it's expected.

When you import the logger from your server file, you're importing it from the app folder. When you import it from other files, what's actually running is the code in the build folder.

So you actually have two loggers: the one in (for example) app/logger.js and the one in build/server/index.js. Both are being used when you run your app.

I believe you wouldn't have that problem if you used https://github.com/kiliman/remix-express-vite-plugin because the server file wouldn't exist.

I hope the Remix team is aware that this is confusing and can find a solution in the future.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@gustavopch
Comment options

Answer selected by Nick-Minutello
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants