I have been using a unique Vue SPA boilerplate found at this link, which utilizes webpack as its foundation.
During the development process or when deploying the application, I have successfully utilized process.env.NODE_ENV
to differentiate between a development and production build. Everything has been working smoothly so far.
Now, I am looking for a method to pass command line arguments that can be interpreted in a similar way. For example, I would like to run a command like npm run dev --foo=1
and then retrieve it using something like process.argv.slice(2).foo
.
I have attempted to access command line arguments within the configuration files and also tried modifying them with no luck.
Another approach I experimented with was passing arguments through "env" using --env.foo
and adjusting the node modules export accordingly:
module.exports = env => {
// utilize the env variable here
}
Unfortunately, none of these attempts have been successful. Is there a glaring oversight on my part?