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

- https://github.com/facebook/react/issues/20186
  - https://github.com/facebook/react/pull/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.

---

There have been quite a few version releases for Rollup and the plugins that are currently used, as well as a number of the official Rollup plugins changing package name to use the `@rollup/*` package prefix.

Looking at [`package.json`](https://github.com/facebook/react/blob/main/package.json#L86-L92) we can see all of the current Rollup packages:

```jsonc
// ..snip..
    "rollup": "^1.19.4",
    "rollup-plugin-babel": "^4.0.1",
    "rollup-plugin-commonjs": "^9.3.4",
    "rollup-plugin-node-resolve": "^2.1.1",
    "rollup-plugin-prettier": "^0.6.0",
    "rollup-plugin-replace": "^2.2.0",
    "rollup-plugin-strip-banner": "^0.2.0",
// ..snip..
```

And using `grep`, we can see some additional usages under `packages/`:

```shell
⇒  grep -r 'rollup' package.json packages/*/package.json
package.json:    "rollup": "^1.19.4",
package.json:    "rollup-plugin-babel": "^4.0.1",
package.json:    "rollup-plugin-commonjs": "^9.3.4",
package.json:    "rollup-plugin-node-resolve": "^2.1.1",
package.json:    "rollup-plugin-prettier": "^0.6.0",
package.json:    "rollup-plugin-replace": "^2.2.0",
package.json:    "rollup-plugin-strip-banner": "^0.2.0",
package.json:    "build": "node ./scripts/rollup/build.js",
package.json:    "build-combined": "node ./scripts/rollup/build-all-release-channels.js",
package.json:    "lint-build": "node ./scripts/rollup/validate/index.js",
packages/react-devtools-extensions/package.json:    "rollup": "^1.19.4",
packages/react-devtools-extensions/package.json:    "rollup-plugin-babel": "^4.0.1",
packages/react-devtools-extensions/package.json:    "rollup-plugin-commonjs": "^9.3.4",
packages/react-devtools-extensions/package.json:    "rollup-plugin-node-resolve": "^2.1.1",
```

The following is an attempt to capture all of the relevant information about package name changes, new versions, breaking changes, etc for these packages:

- https://github.com/rollup/rollup
  - https://www.npmjs.com/package/rollup
    - Lockfile currently resolves to `version "1.31.1"`
      - https://github.com/rollup/rollup/blob/master/CHANGELOG.md#1311
      - The latest version is `2.76.0`, but there are a number of other breaking changes leading up to that version
        - https://github.com/rollup/rollup/blob/master/CHANGELOG.md#200
          - > Breaking Changes
- https://github.com/rollup/plugins#plugins-found-here
  - https://github.com/rollup/plugins/tree/master/packages/babel
    - https://www.npmjs.com/package/@rollup/plugin-babel
      - Lockfile currently resolves to `version "4.3.3"`
      - Oldest version for `@rollup/plugin-babel` package name is `5.0.0`
        - https://github.com/rollup/plugins/blob/master/packages/babel/CHANGELOG.md#500
          - > Breaking Changes
            - > Minimum compatible Rollup version is 1.2.0
            - > Minimum supported Node version is 10.0.0
            - > `.custom` factory is now available as separate `createBabelInputPluginFactory` export
            - > Removed `externalHelpers` & `runtimeHelpers` options. There is now a single `babelHelpers` option which can take one of `'bundled'`, `'inline'`, `'runtime'` and `'external'` as a value. The default is `'bundled'` which matches `4.x` behavior, but it is recommended to configure this option explicitly.
        - There don't seem to be any other breaking changes up till the latest version which is `5.3.1`
  - https://github.com/rollup/plugins/tree/master/packages/commonjs
    - https://www.npmjs.com/package/@rollup/plugin-commonjs
    - Lockfile currently resolves to `version "9.3.4"`
    - Oldest version for `@rollup/plugin-commonjs` package name is `11.0.0`
      - https://github.com/rollup/plugins/blob/master/packages/commonjs/CHANGELOG.md#1100
        - > Breaking: Minimum compatible Rollup version is 1.20.0
        - > Breaking: Minimum supported Node version is 8.0.0
      - The latest version is `22.0.1`, but there are a number of other breaking changes leading up to that version
    - Based on some comments in the source, I believe this dependency is only used for `react-art`, so presumably if that still works properly with the newest version of this lib, we could update to that.
  - https://github.com/rollup/plugins/tree/master/packages/node-resolve
    - https://www.npmjs.com/package/@rollup/plugin-node-resolve
      - Lockfile currently resolves to `version "2.1.1"`
      - Oldest version for `@rollup/plugin-node-resolve` package name is `6.0.0`
        - https://github.com/rollup/plugins/blob/master/packages/node-resolve/CHANGELOG.md#600
          - > Breaking: Minimum compatible Rollup version is 1.20.0
          - > Breaking: Minimum supported Node version is 8.0.0
        - https://github.com/rollup/plugins/blob/master/packages/node-resolve/CHANGELOG.md#500-2019-05-15
          - > Breaking Changes
            - > Requires at least rollup@1.11.0 to work (v1.12.0 for module side-effects to be respected)
            - > If used with rollup-plugin-commonjs, it should be at least v10.0.0
        - https://github.com/rollup/plugins/blob/master/packages/node-resolve/CHANGELOG.md#300
          - > [BREAKING] Remove `options.skip`
        - The latest version is `13.3.0`, but there are a number of other breaking changes leading up to that version
  - https://github.com/rollup/plugins/tree/master/packages/replace
    - https://www.npmjs.com/package/@rollup/plugin-replace
      - Lockfile currently resolves to `version "2.2.0"`
      - Oldest version for `@rollup/plugin-replace` package name is `2.2.0`
        - https://github.com/rollup/plugins/blob/master/packages/replace/CHANGELOG.md#220
        - The latest version is `4.0.0`, but there are a number of other breaking changes leading up to that version
- https://github.com/mjeanroy/rollup-plugin-strip-banner
  - https://www.npmjs.com/package/rollup-plugin-strip-banner
    - Lockfile currently resolves to `version "0.2.0"`
      - https://github.com/mjeanroy/rollup-plugin-strip-banner/blob/master/CHANGELOG.md#020-2017-05-10
      - The latest version is `2.0.0`. The changelog doesn't explicitly mention any breaking changes, but I didn't look into it too deeply
      - **Edit:** Seems there is a secondary changelog in the README, though it still doesn't mention any breaking changes: https://github.com/mjeanroy/rollup-plugin-strip-banner#changelogs
- https://github.com/mjeanroy/rollup-plugin-prettier
   - https://www.npmjs.com/package/rollup-plugin-prettier
    - Lockfile currently resolves to `version "0.6.0"`
      - https://github.com/mjeanroy/rollup-plugin-prettier/blob/master/CHANGELOG.md#060-2019-01-16
      - The latest version is `2.2.2`. The changelog doesn't explicitly mention any breaking changes, but I didn't look into it too deeply
      - **Edit:** Seems there is a secondary changelog in the README that mentions a breaking change: https://github.com/mjeanroy/rollup-plugin-prettier#changelogs
        - > Breaking Change: prettier dependency is now a peer dependency instead of a "direct" dependency: user of the plugin can choose to use prettier 1.x.x or prettier 2.x.x (note that this plugin should be compatible with all versions of prettier).

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:

- https://github.com/facebook/react/issues/24891
  - https://github.com/facebook/react/pull/24892

---

My plan/intent is to work through all of this and create a PR updating Rollup and the related plugins; but I wanted to create this issue in the meantime to capture what I have done so far, and also check whether there would be any issues/concerns with a PR like this being made.

**Edit:** PR opened in:

- https://github.com/facebook/react/pull/24916
filename,
      packageName,
      bundleType,
      bundle.global,
      bundle.moduleType,
      pureExternalModules,
      bundle
    ),
    output: {
      externalLiveBindings: false,
      freeze: false,
      interop: false,
      esModule: false,
    },
  };
  const mainOutputPath = Packaging.getBundleOutputPath(
    bundle,
    bundleType,
    filename,
    packageName
  );
  const rollupOutputOptions = getRollupOutputOptions(
    mainOutputPath,
    format,
    peerGlobals,
    bundle.global,
    bundleType
  );
  if (isWatchMode) {
    rollupConfig.output = [rollupOutputOptions];