Unverified Commit e2dc3fc5 authored by Joe Haddad's avatar Joe Haddad
Browse files

Lessen significance of browserslist

Adjust the default browsers to be a single list and remove it from the build output; it only affects CSS now
parent a1a08dba
Showing with 8 additions and 48 deletions
+8 -48
......@@ -13,12 +13,7 @@ const inquirer = require('inquirer');
const pkgUp = require('pkg-up');
const fs = require('fs');
const defaultBrowsers = {
development: ['chrome', 'firefox', 'edge'].map(
browser => `last 2 ${browser} versions`
),
production: ['>0.25%', 'not op_mini all', 'ie 11'],
};
const defaultBrowsers = ['>0.25%', 'not op_mini all', 'ie 11'];
function checkBrowsers(dir, retry = true) {
const current = browserslist.findConfig(dir);
......@@ -66,16 +61,7 @@ function checkBrowsers(dir, retry = true) {
console.log();
console.log(chalk.green('Set target browsers:'));
console.log();
console.log(
`\t${chalk.bold('Production')}: ${chalk.cyan(
defaultBrowsers.production.join(', ')
)}`
);
console.log(
`\t${chalk.bold('Development')}: ${chalk.cyan(
defaultBrowsers.development.join(', ')
)}`
);
console.log(`\t${chalk.cyan(defaultBrowsers.join(', '))}`);
console.log();
})
// Swallow any error
......@@ -88,20 +74,4 @@ function checkBrowsers(dir, retry = true) {
});
}
function printBrowsers(dir) {
return checkBrowsers(dir).then(browsers => {
if (browsers == null) {
console.log('Built the bundle with default browser support.');
return;
}
browsers = browsers[process.env.NODE_ENV] || browsers;
if (Array.isArray(browsers)) {
browsers = browsers.join(', ');
}
console.log(
`Built the bundle with browser support for ${chalk.cyan(browsers)}.`
);
});
}
module.exports = { defaultBrowsers, checkBrowsers, printBrowsers };
module.exports = { defaultBrowsers, checkBrowsers };
......@@ -80,17 +80,9 @@
"optionalDependencies": {
"fsevents": "1.2.4"
},
"browserslist": {
"development": [
"last 2 chrome versions",
"last 2 firefox versions",
"last 2 edge versions"
],
"production": [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 11"
]
}
"browserslist": [
">0.25%",
"not op_mini all",
"ie 11"
]
}
......@@ -41,7 +41,6 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const printBuildError = require('react-dev-utils/printBuildError');
const { printBrowsers } = require('react-dev-utils/browsersHelper');
const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild;
......@@ -119,7 +118,6 @@ checkBrowsers(paths.appPath)
buildFolder,
useYarn
);
printBrowsers(paths.appPath);
},
err => {
console.log(chalk.red('Failed to compile.\n'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment