DEV Community

[Comment from a deleted post]
Collapse
 
designbyonyx profile image
Ryan Wheale

Great article. I recommend importing the Build object from @stencil/core - it has properties for isDev and isBrowser which are more helpful than argv. The reason for this is that you might some day trigger your build through a programmatic API (eg. stencil.build({ dev: true })) instead of the CLI - in which case process.argv would not contain the dev flag.

NOTE: the programmatic API doesn't exist today AFAIK, but it might in the future.

Collapse
 
daviddalbusco profile image
David Dal Busco

Could do the job too effectively, thx for the comment.

Relying on the CLI has the advantages of being extendable (if for example I would like to have more than two environments, like "test, staging and prod"). Also it works well together in case you would like to hide values from your repo (related post which followed that one: dev.to/daviddalbusco/hide-environm...).

But like I said, yep, it works too with Build.