-
-
Notifications
You must be signed in to change notification settings - Fork 40
webpack is not picking up the CLI environment variables #1143
Description
configs.zip
Environment
Provide version numbers for the following components (information can be retrieved by running tns info
in your project folder or by inspecting the package.json
of the project):
-
CLI: 6.4.0
-
Cross-platform modules:
-
Android Runtime:
-
iOS Runtime: 10.15
-
Plugin(s):
-
Node.js: 12.18.3
-
Please, attach your package.json and webpack.config.js as these configurations are usually critical for investigating issues with webpack
Describe the bug
I'm building a nativescript-vue app
I'm unable to read environment variables passed from the command line when using the nativescript CLI.
Inside of webpack.config.js I expect to be able to do a console.log(env) and see the variables I've passed to the tns run command printed out.
To Reproduce
tns run ios --device 'iPhone 11' --env.server_url=localhost:3000
Expected behavior
// webpack.config.js
module.exports = env => {
console.dir(env); // { server_url: 'localhost:3000' }
}
Sample project
Additional context
Ultimately my goal is to be able to pass the variables to DefinePlugin so that In can access them in Vue application.
Note -- I understand that webpack.DefinePlugin will simply do a textual replace of the value provide.