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

Make browsers list configurable - revisited #3183

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8512933
Autoprefixer's browsers option is currently hardcoded. This PR adds t…
cr101 May 25, 2017
d2ba437
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 May 25, 2017
377d70e
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 May 25, 2017
a617388
Make the browsers list more readable
cr101 May 25, 2017
d479b9f
Stack the browsers underneath each other
cr101 May 25, 2017
aa25bab
Check if browserslist is in package.json and if not then force it
cr101 May 30, 2017
4c02989
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 May 30, 2017
6d93bb7
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 Jun 2, 2017
68fed74
Use default values when browserslist is not specified in package.json
cr101 Jun 2, 2017
ebc436a
Remove old 2009 syntax of Flexbox (i.e -webkit-box, -webkit-box-*) w…
cr101 Jun 2, 2017
9ec67b4
lerna-changelog
cr101 Jun 28, 2017
4f40f6f
upstream changes
cr101 Jun 28, 2017
7177a59
remove warning messages
cr101 Jun 29, 2017
fa50ef5
Merge branch 'master' into master
cr101 Jun 29, 2017
135b90d
Delete yarn.lock
cr101 Jun 29, 2017
30d3727
Delete cra.js
cr101 Jun 29, 2017
eb01f6d
update my local copy
cr101 Jun 29, 2017
1eeee99
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 Jun 29, 2017
fedf184
Delete package-lock.json
cr101 Jun 29, 2017
6bc0271
Delete package-lock.json
cr101 Jun 29, 2017
621e2bd
Delete package-lock.json
cr101 Jun 29, 2017
89e8437
Delete package-lock.json
cr101 Jun 29, 2017
aed45d2
Delete package-lock.json
cr101 Jun 29, 2017
317cfe6
Merge branch 'master' of https://github.com/cr101/create-react-app
cr101 Jun 29, 2017
9bad6a7
Merge branch 'master' of https://github.com/facebookincubator/create-…
cr101 Jun 30, 2017
a20d038
Merge remote-tracking branch 'cr101/master'
kasperpeulen Sep 24, 2017
80a3cb5
chmod back to 755
kasperpeulen Sep 24, 2017
7cd5c0b
don't add browserlist field standard to package.json
kasperpeulen Sep 24, 2017
e6a7ff8
undo changes to README unrelated to PR
kasperpeulen Sep 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ const publicUrl = '';
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicUrl);

// Get supported browsers list
let supportedBrowsers = require(paths.appPackageJson).browserslist;
if (!supportedBrowsers || Object.keys(supportedBrowsers).length === 0) {
// Assign default browsers when browserslist is not specified
supportedBrowsers = [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
]
}

// This is the development configuration.
// It is focused on developer experience and fast rebuilds.
// The production configuration is different and lives in a separate file.
Expand Down Expand Up @@ -204,12 +216,7 @@ module.exports = {
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
browsers: supportedBrowsers,
flexbox: 'no-2009',
}),
],
Expand Down
19 changes: 13 additions & 6 deletions packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
const paths = require('./paths');
const getClientEnvironment = require('./env');

// Get supported browsers list
let supportedBrowsers = require(paths.appPackageJson).browserslist;
if (!supportedBrowsers || Object.keys(supportedBrowsers).length === 0) {
// Assign default browsers when browserslist is not specified
supportedBrowsers = [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
];
}

// Webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path.
const publicPath = paths.servedPath;
Expand Down Expand Up @@ -218,12 +230,7 @@ module.exports = {
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
browsers: supportedBrowsers,
flexbox: 'no-2009',
}),
],
Expand Down