Skip to content

Update Webpack client variables - #1607

Draft
victorlin wants to merge 3 commits into
masterfrom
victorlin/update-webpack-client-vars
Draft

Update Webpack client variables#1607
victorlin wants to merge 3 commits into
masterfrom
victorlin/update-webpack-client-vars

Conversation

@victorlin

@victorlin victorlin commented Dec 3, 2022

Copy link
Copy Markdown
Member

Description of proposed changes

See commit messages. I thought of these while working on #1520, but believe these changes can be made independently of the Webpack upgrade.

Tasks

  • Configure Jest to recognize the new global variable.

Related issue(s)

N/A

Testing

Based on a warning in the DefinePlugin docs¹, previous usage of a
"process.env" key has the potential to break any modules that might use
the process.env object. Luckily (so far) there is no such conflict in
this project, but good to future-proof.

¹ https://v4.webpack.js.org/plugins/define-plugin/#usage
The process.env scope is commonly used in Node.js projects to contain
variables injected from an external context. For Webpack, the scope can
be any arbitrary name.

"webpackConfig" is more self-describing and avoids potential confusion
for someone searching the codebase. Without this change, one might
suspect that `process.env.PORT` referenced in cli/ files comes from the
same source as `process.env.NODE_ENV` when that's not the case - they
are entirely independent.
@victorlin victorlin self-assigned this Dec 3, 2022
@nextstrain-bot
nextstrain-bot temporarily deployed to auspice-victorlin-updat-j7iwwr December 3, 2022 04:10 Inactive
@nextstrain-bot
nextstrain-bot temporarily deployed to auspice-victorlin-updat-j7iwwr December 3, 2022 04:35 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants