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

Add webpack plugin to extract envVars during compilation so we know w… #19

Merged
merged 2 commits into from
Dec 7, 2018

Conversation

MentalAtom
Copy link

Extracts the env vars that we need into a envVars file in the build folder, which we can then use in in inject-env-vars to pass in the required values.

Copy link

@dchambers dchambers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff 👍


compiler.hooks.compilation.tap('ExtractEnvVarsPlugin', (compilation) => {
compilation.hooks.optimizeChunks.tap('ExtractEnvVarsPlugin', chunks => {
chunks.forEach(chunk => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chunk of code is a little hard to follow. It might benefit from being split out into one or more descriptively named functions to aid readability.

Copy link

@dchambers dchambers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MentalAtom MentalAtom merged commit bd08bdf into cra-v2 Dec 7, 2018
@MentalAtom MentalAtom deleted the cra-v2-extract-env-vars branch December 7, 2018 11:52
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