Closed carere closed 3 years ago
Hello! You actually can do this today. Please read our guide on setting env vars. Or if you’d actually like to keep using process.env
but want to transform it, you can do that today by writing a Snowpack plugin that lets you customize the output.
The “lite” build pipeline you refer to is somewhat true, but I’d like to make a clarification: the build pipelines of dev and build are 100% the same (otherwise that would be unpredictable!), however in dev the optimize settings & plugins are skipped. But any plugin you write will run in dev & build all the same.
The problem that you want to solve. If i use
process.env
statements in the browser, they will not be interpreted since node do not run in the browser. The problem come from the fact that Snowpack run a "lite" build pipeline in order to deliver faster build on dev server.Your take on the correct solution to problem. We should be able to configure the build pipeline for the dev server the same way we are able to do it for production build.
Are you willing to submit a pull request to implement this change? I would like to try, but i don't have lot of time :)