Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !2576

Add a compile time to webpack dev server and react-scripts

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/alexnewmannn/AddCompileTime into master 8 years ago
  • Overview 8
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: alexnewmannn

screen shot 2017-06-20 at 10 18 30

image

image

tested by installing react-scripts in a projet, running npm link on react-scripts and react-dev-utils from my fork, and then running npm link react-scripts and npm link react-dev-utils in my project, and running the build and dev task within.

This will show a compile time on each subsequent watch, and on build tasks as discussed in #2546 (closed)

Compare
  • master (base)

and
  • latest version
    df1b6142
    1 commit, 2 years ago

2 files
+ 9
- 5

    Preferences

    File browser
    Compare changes
pack‎ages‎
react-d‎ev-utils‎
WebpackDevSe‎rverUtils.js‎ +5 -3
react-scri‎pts/scripts‎
buil‎d.js‎ +4 -2
packages/react-dev-utils/WebpackDevServerUtils.js
+ 5
- 3
  • View file @ df1b6142


@@ -143,6 +143,8 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
// "done" event fires when Webpack has finished recompiling the bundle.
// Whether or not you have warnings or errors, you will get this event.
compiler.plugin('done', stats => {
const compileTime = parseFloat((Math.abs(stats.endTime - stats.startTime) / 1000).toFixed(2));
if (isInteractive) {
clearConsole();
}
@@ -153,7 +155,7 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
const messages = formatWebpackMessages(stats.toJson({}, true));
const isSuccessful = !messages.errors.length && !messages.warnings.length;
if (isSuccessful) {
console.log(chalk.green('Compiled successfully!'));
console.log(chalk.green('Compiled successfully in ' + compileTime + 's!'));
}
if (isSuccessful && (isInteractive || isFirstCompile)) {
printInstructions(appName, urls, useYarn);
@@ -162,14 +164,14 @@ function createCompiler(webpack, config, appName, urls, useYarn) {
// If errors exist, only show errors.
if (messages.errors.length) {
console.log(chalk.red('Failed to compile.\n'));
console.log(chalk.red('Failed to compile after ' + compileTime + 's.\n'));
console.log(messages.errors.join('\n\n'));
return;
}
// Show warnings if no errors were found.
if (messages.warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(chalk.yellow('Compiled in ' + compileTime + 's with warnings.\n'));
console.log(messages.warnings.join('\n\n'));
// Teach some ESLint tricks.
packages/react-scripts/scripts/build.js
+ 4
- 2
  • View file @ df1b6142


@@ -58,8 +58,10 @@ measureFileSizesBeforeBuild(paths.appBuild)
})
.then(
({ stats, previousFileSizes, warnings }) => {
const compileTime = parseFloat((Math.abs(stats.endTime - stats.startTime) / 1000).toFixed(2));
if (warnings.length) {
console.log(chalk.yellow('Compiled with warnings.\n'));
console.log(chalk.yellow('Compiled in ' + compileTime + 's with warnings.\n'));
console.log(warnings.join('\n\n'));
console.log(
'\nSearch for the ' +
@@ -72,7 +74,7 @@ measureFileSizesBeforeBuild(paths.appBuild)
' to the line before.\n'
);
} else {
console.log(chalk.green('Compiled successfully.\n'));
console.log(chalk.green('Compiled successfully in ' + compileTime + 's!'));
}
console.log('File sizes after gzip:\n');
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
CLA Signed
1
CLA Signed
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app!2576
Source branch: github/fork/alexnewmannn/AddCompileTime

Menu

Explore Projects Groups Snippets