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.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Great article. I recommend importing the
Build
object from@stencil/core
- it has properties forisDev
andisBrowser
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 caseprocess.argv
would not contain thedev
flag.NOTE: the programmatic API doesn't exist today AFAIK, but it might in the future.
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
.