Rename process(.browser) to env(.browser)
martonlederer opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
process
is a reserved variable by node. Typescript will always throw an error when using process.browser
, because the browser
field does not exist on the process
type.
Describe the solution you'd like
Renaming the process
variable to env
or some other name related to environment would solve this issue.
Describe alternatives you've considered
// @ts-ignore
always works, but it is not a good practice
How important is this feature to you?
I think it is very important to not just me, but everyone using Sapper with Typescript. Linting and checking would also be easier after this change.
env
is not something that exists in node or the browser, so this would fix a typescript error by breaking everything else.
I would suggest that we put this under import.meta
instead which I believe is designed for this sort of thing.
I would open a pull request for this. @antony do you know where can I find the code for this in the repo?
It's just in the rollup.config.js
file in the template. It's not a Sapper concept.
Closing this as the variable name has already been changed in the next evolution of Sapper, and won't be fixed here.