You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really nice to be able to define variables at compile-time in remix.config.js and have dead code to be removed based on that. This would be especially useful for using the in-source testing in vitest where you would want to define import.meta.vitest to be undefined in order to eliminate dead code.
It looks like the esbuild configuration option to define variables is already being used as part of the remix compiler.
Though I'm not sure how much dead code elimination esbuild will actually do. It says here that it won't eliminate dead code within a function body, so it might only work for top-level code.
Also worth noting: I don't think exposing an option to do this would lock remix into its current compiler setup. Many other bundlers support this option. The vitest docs provide a few examples here.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
It would be really nice to be able to define variables at compile-time in
remix.config.js
and have dead code to be removed based on that. This would be especially useful for using the in-source testing in vitest where you would want to defineimport.meta.vitest
to be undefined in order to eliminate dead code.It looks like the esbuild configuration option to define variables is already being used as part of the remix compiler.
remix/packages/remix-dev/compiler.ts
Lines 388 to 393 in a2e1449
Though I'm not sure how much dead code elimination esbuild will actually do. It says here that it won't eliminate dead code within a function body, so it might only work for top-level code.
Also worth noting: I don't think exposing an option to do this would lock remix into its current compiler setup. Many other bundlers support this option. The vitest docs provide a few examples here.
Beta Was this translation helpful? Give feedback.
All reactions