Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Custom environment variables to node.js when running webpack tasks #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vhiairrassary
Copy link
Contributor

WIP ⚠️:

  • Only one function of util.Commands.scala has been updated to accept extra env. vars. Should I update the others too?

If adding this new option seems ok to the maintainers then I can add a test.

Usage example:

webpackNodeEnvVars in fullOptJS := Map(
  "NODE_ENV" -> "production"
)

@julienrf
Copy link
Contributor

julienrf commented Sep 2, 2019

Thanks @vhiairrassary for the PR!

We already have the npmExtraArgs setting, could it be used to pass environment variables as well?

@vhiairrassary
Copy link
Contributor Author

@julienrf From my understanding webpack is not launched using npm. Did I miss something?

@julienrf
Copy link
Contributor

julienrf commented Sep 2, 2019

Indeed, webpackNodeArgs is the correct setting name. (We have so many *Args settings…)

@julienrf
Copy link
Contributor

julienrf commented Sep 2, 2019

But, according to the documentation it seems that env variables don’t have arguments equivalent, so we must provide a way to pass env variables, right?

@vhiairrassary
Copy link
Contributor Author

I did not use the name webpackNodeArgs as there is no way to set env. var. for a Node.js script using command line options.

So I created webpackNodeEnvVars which is different (as it set the launched process environnent) but I also understand that adding an other similar setting is not ideal 😔

@julienrf
Copy link
Contributor

julienrf commented Sep 2, 2019

Thanks, I now completely understand the issue addressed by this PR, and I agree that we should address this issue.

I’m a bit worried by all these *Args keys defined by the ScalaJSBundlerPlugin, but I believe the problem is more general, I’ve written my thoughts about it in #314. In the meantime, I’m happy to merge your PR after all the places where we invoke node are updated.

@vhiairrassary
Copy link
Contributor Author

Hum, after having read #314 (comment), I understand why these variables (such as webpackNodeEnvVars) may be out of scope for this project. Now I am sure it is a good idea to merge that PR 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants