Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

webpack is not picking up the CLI environment variables #1143

Closed
@hraynaud

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /