Skip to content

Commit

Permalink
Autoprefixer's browsers option is currently hardcoded. This PR adds t…
Browse files Browse the repository at this point in the history
…he 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
  • Loading branch information
cr101 committed May 25, 2017
1 parent 2558c3e commit 8512933
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
6 changes: 0 additions & 6 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,6 @@ module.exports = {
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
Expand Down
6 changes: 0 additions & 6 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,6 @@ module.exports = {
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
Expand Down
2 changes: 1 addition & 1 deletion packages/react-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"react-scripts": "./bin/react-scripts.js"
},
"dependencies": {
"autoprefixer": "7.1.0",
"autoprefixer": "7.1.1",
"babel-core": "6.24.1",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
Expand Down
5 changes: 5 additions & 0 deletions packages/react-scripts/scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ module.exports = function(
eject: 'react-scripts eject',
};

appPackage.browserslist = {
production: ['> 1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'],
development: ['last 1 version'],
};

fs.writeFileSync(
path.join(appPath, 'package.json'),
JSON.stringify(appPackage, null, 2)
Expand Down

0 comments on commit 8512933

Please sign in to comment.