GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add source maps by jasonwilliams · Pull Request #21946 · react/react

Conversation

@jasonwilliams

@jasonwilliams jasonwilliams commented Jul 23, 2021

Copy link
Copy Markdown
Contributor

Fixes #20186

Summary

Attempts to get sourcemaps working.

Status:

  • only the renderChunk is commented out for now as I had to give up with that one
  • Sourcemap generation is slow on the prettier plugin. Maybe sourcemaps aren't needed if we're generating "pretty" views anyway? We should disable this if shouldStayReadable is true.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

justingrant, remorses, piotr-oles, wangkaiwd, astoilkov, 0xdevalias, and robpalme reacted with thumbs up emoji 0xdevalias reacted with heart emoji
All reactions
  • 👍 7 reactions
  • ❤️ 1 reaction
jasonwilliams added 2 commits July 15, 2021 23:52
@jasonwilliams
attempt to add sourcemap support
1cd0b9a
@jasonwilliams
include terser
7880112
@facebook-github-bot facebook-github-bot added the CLA Signed label Jul 23, 2021
@jasonwilliams jasonwilliams mentioned this pull request Jul 23, 2021
Distribute source maps for easier debugging in Chrome's Performance tab #20186
Closed
@jasonwilliams jasonwilliams mentioned this pull request Oct 10, 2021
Question: Building react with sourcemaps #14361
Closed
@stale

stale Bot commented Jan 8, 2022

Copy link
Copy Markdown

This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot added the Resolution: Stale Automatically closed due to inactivity label Jan 8, 2022
@justingrant

justingrant commented Jan 8, 2022

Copy link
Copy Markdown
Contributor

not stale

0xdevalias reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stale stale Bot removed the Resolution: Stale Automatically closed due to inactivity label Jan 8, 2022
0xdevalias
0xdevalias reviewed Jul 10, 2022
View reviewed changes

@0xdevalias 0xdevalias left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A rather verbose review + deep dive research into the context of why certain changes were made here, as well as potential solutions for what I believe are the remaining issues that would block this PR from landing. At least in theory, I think all of the potential issues have solutions now. Would love to see this work able to land!

There are a few minor code cleanup 'suggestions' as well, which can all be automatically applied as a single commit as follows:

  • https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/incorporating-feedback-in-your-pull-request#applying-suggested-changes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
const shouldStayReadable = isFBWWWBundle || isRNBundle || forcePrettyOutput;
return [
// Extract error codes from invariant() messages into a file.
// // Extract error codes from invariant() messages into a file.

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // Extract error codes from invariant() messages into a file.
// Extract error codes from invariant() messages into a file.

There seem to be a bunch of places where the comment // has been doubled up in this PR. While it's minor, it will help minimise the diff to better see where the real changes are happening.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
Comment on lines -378 to +397
// Use Node resolution mechanism.
resolve({
skip: externals,
}),
// Remove license headers from individual modules
// // Use Node resolution mechanism.
resolve(),

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was skip: externals removed from resolve here out of curiosity?

It looks like the old version of the library removed it in 3.0.0 in favour of using external:

  • https://github.com/rollup/rollup-plugin-node-resolve/blob/master/CHANGELOG.md#300
    • [BREAKING] Remove options.skip rollup/rollup-plugin-node-resolve#90
      • People are better off using the external option in the main Rollup config

  • https://github.com/rollup/rollup-plugin-node-resolve#resolving-built-ins-like-fs

Looking at the options for the new library, these are the parts that seem potentially relevant:

  • https://github.com/rollup/plugins/tree/master/packages/node-resolve#options
  • https://github.com/rollup/plugins/tree/master/packages/node-resolve#resolving-built-ins-like-fs

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
Comment on lines +378 to +391
// // Turn __DEV__ and process.env checks into constants.
replace({
preventAssignment: true,
values: {
__DEV__: isProduction ? 'false' : 'true',
__PROFILE__: isProfiling || !isProduction ? 'true' : 'false',
__UMD__: isUMDBundle ? 'true' : 'false',
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
__EXPERIMENTAL__,
// Enable forked reconciler.
// NOTE: I did not put much thought into how to configure this.
__VARIANT__: bundle.enableNewReconciler === true,
},
}),

@0xdevalias 0xdevalias Jul 10, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious, why was this moved earlier in the chain of things? (originally down around line 402-412)

I suspect that this may be incorrect, as now it is being run before useForks, which could result in different code being imported (and thus more potential locations of use strict.


Comparing the diff, the main changes seem to be the addition of preventAssignment, and wrapping the values (presumably based on a change in the options of the new lib version)

New lib:

  • https://github.com/rollup/plugins/tree/master/packages/replace#options
  • https://github.com/rollup/plugins/tree/master/packages/replace#preventassignment
    • Prevents replacing strings where they are followed by a single equals sign.

Old lib:

  • https://github.com/rollup/rollup-plugin-replace#options
    • All other options are treated as string: replacement replacers...

    • ...unless you want to be careful about separating values from other options, in which case you can

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
__VARIANT__: bundle.enableNewReconciler === true,
},
}),
// // Shim any modules that need forking in this environment.

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // Shim any modules that need forking in this environment.
// Shim any modules that need forking in this environment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
// // Shim any modules that need forking in this environment.
useForks(forks),
// Ensure we don't try to bundle any fbjs modules.
// // Ensure we don't try to bundle any fbjs modules.

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // Ensure we don't try to bundle any fbjs modules.
// Ensure we don't try to bundle any fbjs modules.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
babelHelpers: 'bundled',
babelrc: false,
configFile: false,
sourceMaps: true,

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like @rollup/plugin-babel generates sourcemaps by default since 2.1.0:

  • https://github.com/rollup/plugins/blob/master/packages/babel/CHANGELOG.md#210

So we probably don't need to add this (unless it's also going to other plugins that don't set it by default?)

Suggested change
sourceMaps: true,

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread package.json
Comment on lines +39 to +42
"@rollup/plugin-replace": "^2.4.2",
"@rollup/plugin-commonjs": "19.0.1",
"@rollup/plugin-node-resolve": "^13.0.1",
"@rollup/plugin-babel": "^5.3.0",

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest versions:

  • https://www.npmjs.com/package/@rollup/plugin-replace (4.0.0)
  • https://www.npmjs.com/package/@rollup/plugin-commonjs (22.0.1)
  • https://www.npmjs.com/package/@rollup/plugin-node-resolve (13.3.0)
  • https://www.npmjs.com/package/@rollup/plugin-babel (5.3.1)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread package.json
Comment on lines +90 to +93
"rollup": "^2.53.2",
"rollup-plugin-prettier": "^2.1.0",
"rollup-plugin-strip-banner": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Latest versions:

  • https://www.npmjs.com/package/rollup (2.76.0)
  • https://www.npmjs.com/package/rollup-plugin-prettier (2.2.2)
  • https://www.npmjs.com/package/rollup-plugin-strip-banner (2.0.0)
  • https://www.npmjs.com/package/rollup-plugin-terser (7.0.2)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
interop: false,
name: globalName,
sourcemap: false,
sourcemap: !isPretty,

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in another comment in this review, I think maybe we should be using shouldStayReadable here directly, since the only time where we (currently) wouldn't be generating sourcemaps (to my knowledge) is when prettier is called (though personally, if it doesn't change the build time dramatically, I would be potentially inclined to keep it enabled even then)

Suggested change
sourcemap: !isPretty,
sourcemap: !shouldStayReadable,

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread scripts/rollup/build.js
skip: externals,
}),
// Remove license headers from individual modules
// // Use Node resolution mechanism.

@0xdevalias 0xdevalias Jul 10, 2022

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// // Use Node resolution mechanism.
// Use Node resolution mechanism.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Jul 12, 2022
Is AppVeyor still used to test against Windows, can it be moved to CircleCI, and/or can we update it to use a modern/supported version of Node? #24891
Closed
bump AppVeyor Node version from '10.x' to '14.x' (current Maintenance LTS version) #24892
Closed
Upgrade to modern version of Rollup and related plugins #24894
Closed
Update Rollup and related plugins to their most recent versions #24916
Merged
sebmarkbage added a commit that referenced this pull request Feb 20, 2023
@0xdevalias @sebmarkbage
Update Rollup and related plugins to their most recent versions (#24916)
6b6d061
Update Rollup and related plugins to their most recent versions +
resolve any breaking changes/deprecations/etc along the way. I made each
change piece by piece, so the commit history tells a pretty good story
of what was changed where/how/why.

fixes #24894

For the full deepdive/context, see:

- #24894

The inspiration for this came from @jasonwilliams 's PR for attempting
to add sourcemap output support to React's builds:

- #20186
  - #21946

But I figured that it would be useful to minimise the scope of changes
in that PR, and to modernise the build tooling along the way.

If any of these updates rely on a node version later than `10.x`, then
the following PR may have to land first, otherwise things might break on
AppVeyor:

- #24891
  - #24892

Co-authored-by: Sebastian Markbage <[email protected]>
github-actions Bot pushed a commit that referenced this pull request Feb 20, 2023
@sebmarkbage
Update Rollup and related plugins to their most recent versions (#24916)
7b76862
Update Rollup and related plugins to their most recent versions +
resolve any breaking changes/deprecations/etc along the way. I made each
change piece by piece, so the commit history tells a pretty good story
of what was changed where/how/why.

fixes #24894

For the full deepdive/context, see:

- #24894

The inspiration for this came from @jasonwilliams 's PR for attempting
to add sourcemap output support to React's builds:

- #20186
  - #21946

But I figured that it would be useful to minimise the scope of changes
in that PR, and to modernise the build tooling along the way.

If any of these updates rely on a node version later than `10.x`, then
the following PR may have to land first, otherwise things might break on
AppVeyor:

- #24891
  - #24892

Co-authored-by: Sebastian Markbage <[email protected]>

DiffTrain build for [6b6d061](6b6d061)
[View git log for this commit](https://github.com/facebook/react/commits/6b6d0617eff48860c5b4e3e79c74cbd3312cf45a)
@0xdevalias 0xdevalias mentioned this pull request Mar 27, 2023
Generate sourcemaps for production build artifacts #26446
Merged
@0xdevalias

0xdevalias commented Mar 27, 2023

Copy link
Copy Markdown
Contributor

It looks like the work done in the following PR is likely to supercede and replace this PR:

  • Generate sourcemaps for production build artifacts #26446
landsman reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@0xdevalias

0xdevalias commented Dec 1, 2023

Copy link
Copy Markdown
Contributor

Since the above PR (#26446) has been merged, this PR is now obsolete, and can probably be closed out.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jerrydev0927 added a commit to jerrydev0927/react that referenced this pull request Jan 5, 2024
@jerrydev0927
Update Rollup and related plugins to their most recent versions (#24916)
ca34f21
Update Rollup and related plugins to their most recent versions +
resolve any breaking changes/deprecations/etc along the way. I made each
change piece by piece, so the commit history tells a pretty good story
of what was changed where/how/why.

fixes react/react#24894

For the full deepdive/context, see:

- react/react#24894

The inspiration for this came from @jasonwilliams 's PR for attempting
to add sourcemap output support to React's builds:

- react/react#20186
  - react/react#21946

But I figured that it would be useful to minimise the scope of changes
in that PR, and to modernise the build tooling along the way.

If any of these updates rely on a node version later than `10.x`, then
the following PR may have to land first, otherwise things might break on
AppVeyor:

- react/react#24891
  - react/react#24892

Co-authored-by: Sebastian Markbage <[email protected]>

DiffTrain build for [6b6d0617eff48860c5b4e3e79c74cbd3312cf45a](react/react@6b6d061)
[View git log for this commit](https://github.com/facebook/react/commits/6b6d0617eff48860c5b4e3e79c74cbd3312cf45a)
@eps1lon

eps1lon commented Mar 23, 2024

Copy link
Copy Markdown
Collaborator

Resolved in #26446

Thank you @jasonwilliams for starting this effort 👍🏻

jasikpark, justingrant, and jasonwilliams reacted with hooray emoji jasonwilliams reacted with heart emoji
All reactions
  • 🎉 3 reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eps1lon eps1lon closed this Mar 23, 2024
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@0xdevalias @sebmarkbage
Update Rollup and related plugins to their most recent versions (reac…
7362e06
…t#24916)

Update Rollup and related plugins to their most recent versions +
resolve any breaking changes/deprecations/etc along the way. I made each
change piece by piece, so the commit history tells a pretty good story
of what was changed where/how/why.

fixes react#24894

For the full deepdive/context, see:

- react#24894

The inspiration for this came from @jasonwilliams 's PR for attempting
to add sourcemap output support to React's builds:

- react#20186
  - react#21946

But I figured that it would be useful to minimise the scope of changes
in that PR, and to modernise the build tooling along the way.

If any of these updates rely on a node version later than `10.x`, then
the following PR may have to land first, otherwise things might break on
AppVeyor:

- react#24891
  - react#24892

Co-authored-by: Sebastian Markbage <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@0xdevalias 0xdevalias 0xdevalias left review comments
@trueadm trueadm trueadm left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Distribute source maps for easier debugging in Chrome's Performance tab

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@jasonwilliams @justingrant @0xdevalias @eps1lon @trueadm @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.