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
3 merge requests!12191Lim.Pisey.168:/Identified - We are currently investigating reports of missing build logs. The issue has been identified and a resolution is in progress. We will provide a further update when available.Mar 21, 09:02 UTC,!12853brikk,!5717Automatically extract project file structure from build bundle file
Showing with 8 additions and 48 deletions
+8 -48
...@@ -13,12 +13,7 @@ const inquirer = require('inquirer'); ...@@ -13,12 +13,7 @@ const inquirer = require('inquirer');
const pkgUp = require('pkg-up'); const pkgUp = require('pkg-up');
const fs = require('fs'); const fs = require('fs');
const defaultBrowsers = { const defaultBrowsers = ['>0.25%', 'not op_mini all', 'ie 11'];
development: ['chrome', 'firefox', 'edge'].map(
browser => `last 2 ${browser} versions`
),
production: ['>0.25%', 'not op_mini all', 'ie 11'],
};
function checkBrowsers(dir, retry = true) { function checkBrowsers(dir, retry = true) {
const current = browserslist.findConfig(dir); const current = browserslist.findConfig(dir);
...@@ -66,16 +61,7 @@ function checkBrowsers(dir, retry = true) { ...@@ -66,16 +61,7 @@ function checkBrowsers(dir, retry = true) {
console.log(); console.log();
console.log(chalk.green('Set target browsers:')); console.log(chalk.green('Set target browsers:'));
console.log(); console.log();
console.log( console.log(`\t${chalk.cyan(defaultBrowsers.join(', '))}`);
`\t${chalk.bold('Production')}: ${chalk.cyan(
defaultBrowsers.production.join(', ')
)}`
);
console.log(
`\t${chalk.bold('Development')}: ${chalk.cyan(
defaultBrowsers.development.join(', ')
)}`
);
console.log(); console.log();
}) })
// Swallow any error // Swallow any error
...@@ -88,20 +74,4 @@ function checkBrowsers(dir, retry = true) { ...@@ -88,20 +74,4 @@ function checkBrowsers(dir, retry = true) {
}); });
} }
function printBrowsers(dir) { module.exports = { defaultBrowsers, checkBrowsers };
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 };
...@@ -80,17 +80,9 @@ ...@@ -80,17 +80,9 @@
"optionalDependencies": { "optionalDependencies": {
"fsevents": "1.2.4" "fsevents": "1.2.4"
}, },
"browserslist": { "browserslist": [
"development": [ ">0.25%",
"last 2 chrome versions", "not op_mini all",
"last 2 firefox versions", "ie 11"
"last 2 edge versions" ]
],
"production": [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 11"
]
}
} }
...@@ -41,7 +41,6 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); ...@@ -41,7 +41,6 @@ const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
const printBuildError = require('react-dev-utils/printBuildError'); const printBuildError = require('react-dev-utils/printBuildError');
const { printBrowsers } = require('react-dev-utils/browsersHelper');
const measureFileSizesBeforeBuild = const measureFileSizesBeforeBuild =
FileSizeReporter.measureFileSizesBeforeBuild; FileSizeReporter.measureFileSizesBeforeBuild;
...@@ -119,7 +118,6 @@ checkBrowsers(paths.appPath) ...@@ -119,7 +118,6 @@ checkBrowsers(paths.appPath)
buildFolder, buildFolder,
useYarn useYarn
); );
printBrowsers(paths.appPath);
}, },
err => { err => {
console.log(chalk.red('Failed to compile.\n')); 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