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

New example: with-now-env #4073

Merged
merged 2 commits into from
Mar 28, 2018
Merged

New example: with-now-env #4073

merged 2 commits into from
Mar 28, 2018

Conversation

lfades
Copy link
Member

@lfades lfades commented Mar 28, 2018

No description provided.

webpack: config => {
config.plugins.forEach(plugin => {
if (plugin.constructor.name === 'DefinePlugin') {
plugin.definitions['process.env.SECRET'] = JSON.stringify(process.env.SECRET)
Copy link
Member

Choose a reason for hiding this comment

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

Why not just do another defineplugin, is much more readable and future proof.

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of DefinePlugin you could have use EnvironmentPlugin and just do:

new webpack.EnvironmentPlugin(['SECRET'])

That will automatically define process.env.SECRET 😉

Copy link
Member

Choose a reason for hiding this comment

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

@sergiodxa I like explicit mapping though. Especially since this ends up in client bundles.

@timneutkens timneutkens merged commit 9f4e707 into vercel:canary Mar 28, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants