Skip to content

For easier use in the browser, add simple guard against undefined process global#206

Merged
ai merged 1 commit intobrowserslist:masterfrom
acusti:patch-1
Dec 31, 2017
Merged

For easier use in the browser, add simple guard against undefined process global#206
ai merged 1 commit intobrowserslist:masterfrom
acusti:patch-1

Conversation

@acusti
Copy link
Contributor

@acusti acusti commented Dec 31, 2017

When using browserslist with webpack and targeting the browser, users need to add

new webpack.DefinePlugin({ 'process.env': {} }),

to their webpack config in addition to more idiomatic DefinePlugin uses (e.g. new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') })).

This PR adds a very simple typeof test on the process global with a default value to avoid the need for that extra unintuitive bit of config.

@ai ai merged commit af41165 into browserslist:master Dec 31, 2017
@ai
Copy link
Member

ai commented Dec 31, 2017

Thanks. Released in 2.10.1.

zhouyu9527 pushed a commit to zhouyu9527/browserslist that referenced this pull request Jul 5, 2022
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