Skip to content

Commit 8512933

Browse files
committed
Autoprefixer's browsers option is currently hardcoded. This PR adds the browserslist key in package.json which allows developers to set browsers list in queries like "Chrome >= 35", "Firefox >= 38" for both production and development. Autoprefixer which relies on Browserslist will find its config automatically. This PR fixes facebook#2248 and facebook#892
1 parent 2558c3e commit 8512933

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

packages/react-scripts/config/webpack.config.dev.js

-6
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,6 @@ module.exports = {
221221
plugins: () => [
222222
require('postcss-flexbugs-fixes'),
223223
autoprefixer({
224-
browsers: [
225-
'>1%',
226-
'last 4 versions',
227-
'Firefox ESR',
228-
'not ie < 9', // React doesn't support IE8 anyway
229-
],
230224
flexbox: 'no-2009',
231225
}),
232226
],

packages/react-scripts/config/webpack.config.prod.js

-6
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,6 @@ module.exports = {
227227
plugins: () => [
228228
require('postcss-flexbugs-fixes'),
229229
autoprefixer({
230-
browsers: [
231-
'>1%',
232-
'last 4 versions',
233-
'Firefox ESR',
234-
'not ie < 9', // React doesn't support IE8 anyway
235-
],
236230
flexbox: 'no-2009',
237231
}),
238232
],

packages/react-scripts/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"react-scripts": "./bin/react-scripts.js"
2222
},
2323
"dependencies": {
24-
"autoprefixer": "7.1.0",
24+
"autoprefixer": "7.1.1",
2525
"babel-core": "6.24.1",
2626
"babel-eslint": "7.2.3",
2727
"babel-jest": "20.0.3",

packages/react-scripts/scripts/init.js

+5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ module.exports = function(
4949
eject: 'react-scripts eject',
5050
};
5151

52+
appPackage.browserslist = {
53+
production: ['> 1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'],
54+
development: ['last 1 version'],
55+
};
56+
5257
fs.writeFileSync(
5358
path.join(appPath, 'package.json'),
5459
JSON.stringify(appPackage, null, 2)

0 commit comments

Comments
 (0)