Skip to content

Commit 7054190

Browse files
timfishmydea
andauthored
feat(build): Update Rollup to v4 (#11087)
This PR updates Rollup to v4 and updates all the plugins to their latest versions. When testing bundling of the new otel powered Node SDK, there are runtime errors caused by ESM/CJS interoperability. There have been plenty of issues fixed around this in both Rollup and the CommonJs plugin so we need to update. The changelog doesn't do justice for how much of a pain this was. Co-authored-by: Francesco Novy <[email protected]>
1 parent 0f1ea2f commit 7054190

File tree

12 files changed

+296
-226
lines changed

12 files changed

+296
-226
lines changed

Diff for: dev-packages/rollup-utils/npmHelpers.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export function makeBaseNPMConfig(options = {}) {
5252

5353
sourcemap: true,
5454

55+
// Include __esModule property when generating exports
56+
// Before the upgrade to Rollup 4 this was included by default and when it was gone it broke tests
57+
esModule: true,
58+
5559
// output individual files rather than one big bundle
5660
preserveModules: true,
5761

Diff for: dev-packages/rollup-utils/plugins/bundlePlugins.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import * as childProcess from 'child_process';
1313
import commonjs from '@rollup/plugin-commonjs';
1414
import { nodeResolve } from '@rollup/plugin-node-resolve';
1515
import replace from '@rollup/plugin-replace';
16+
import terser from '@rollup/plugin-terser';
1617
import license from 'rollup-plugin-license';
17-
import { terser } from 'rollup-plugin-terser';
1818

1919
/**
2020
* Create a plugin to add an identification banner to the top of stand-alone bundles.

Diff for: package.json

+11-10
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@
8686
],
8787
"devDependencies": {
8888
"@biomejs/biome": "^1.4.0",
89-
"@rollup/plugin-commonjs": "^21.0.1",
89+
"@rollup/plugin-commonjs": "^25.0.7",
9090
"@rollup/plugin-json": "^6.1.0",
91-
"@rollup/plugin-node-resolve": "^13.1.3",
92-
"@rollup/plugin-replace": "^3.0.1",
93-
"@rollup/plugin-sucrase": "^4.0.3",
94-
"@rollup/plugin-typescript": "^8.3.1",
91+
"@rollup/plugin-node-resolve": "^15.2.3",
92+
"@rollup/plugin-replace": "^5.0.5",
93+
"@rollup/plugin-sucrase": "^5.0.2",
94+
"@rollup/plugin-terser": "^0.4.4",
95+
"@rollup/plugin-typescript": "^11.1.6",
9596
"@size-limit/file": "~11.0.1",
9697
"@size-limit/webpack": "~11.0.1",
9798
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
@@ -120,10 +121,9 @@
120121
"prettier": "^3.1.1",
121122
"replace-in-file": "^4.0.0",
122123
"rimraf": "^3.0.2",
123-
"rollup": "^2.67.1",
124-
"rollup-plugin-cleanup": "3.2.1",
125-
"rollup-plugin-license": "^2.6.1",
126-
"rollup-plugin-terser": "^7.0.2",
124+
"rollup": "^4.13.0",
125+
"rollup-plugin-cleanup": "^3.2.1",
126+
"rollup-plugin-license": "^3.3.1",
127127
"sinon": "^7.3.2",
128128
"size-limit": "~11.0.1",
129129
"ts-jest": "^27.1.4",
@@ -134,7 +134,8 @@
134134
"yalc": "^1.0.0-pre.53"
135135
},
136136
"resolutions": {
137-
"**/agent-base": "5",
137+
"wrap-ansi": "7.0.0",
138+
"string-width": "4.1.0",
138139
"**/terser/source-map": "0.7.4"
139140
},
140141
"version": "0.0.0",

Diff for: packages/astro/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
},
5959
"devDependencies": {
6060
"astro": "^3.5.0",
61-
"rollup": "^3.20.2",
6261
"vite": "4.0.5"
6362
},
6463
"scripts": {

Diff for: packages/deno/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"deno-types": "node ./scripts/download-deno-types.mjs",
4040
"build": "run-s build:transpile build:types",
4141
"build:dev": "yarn build",
42-
"build:transpile": "yarn deno-types && rollup -c rollup.config.js",
42+
"build:transpile": "yarn deno-types && rollup -c rollup.config.mjs",
4343
"build:types": "run-s deno-types build:types:tsc build:types:bundle",
4444
"build:types:tsc": "tsc -p tsconfig.types.json",
4545
"build:types:bundle": "rollup -c rollup.types.config.mjs",
File renamed without changes.

Diff for: packages/nextjs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@sentry/webpack-plugin": "2.14.3",
4646
"chalk": "3.0.0",
4747
"resolve": "1.22.8",
48-
"rollup": "2.78.0",
48+
"rollup": "3.29.4",
4949
"stacktrace-parser": "^0.1.10"
5050
},
5151
"devDependencies": {

Diff for: packages/node-experimental/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@
6565
"@sentry/core": "8.0.0-alpha.2",
6666
"@sentry/opentelemetry": "8.0.0-alpha.2",
6767
"@sentry/types": "8.0.0-alpha.2",
68-
"@sentry/utils": "8.0.0-alpha.2",
68+
"@sentry/utils": "8.0.0-alpha.2"
69+
},
70+
"devDependencies": {
6971
"@types/node": "14.18.63"
7072
},
7173
"optionalDependencies": {

Diff for: packages/replay-worker/rollup.examples.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import commonjs from '@rollup/plugin-commonjs';
22
import resolve from '@rollup/plugin-node-resolve';
3+
import terser from '@rollup/plugin-terser';
34
import typescript from '@rollup/plugin-typescript';
45
import { defineConfig } from 'rollup';
5-
import { terser } from 'rollup-plugin-terser';
66

77
import { makeLicensePlugin } from '../../rollup/plugins/index.js';
88

Diff for: packages/replay-worker/rollup.worker.config.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import commonjs from '@rollup/plugin-commonjs';
44
import resolve from '@rollup/plugin-node-resolve';
5+
import terser from '@rollup/plugin-terser';
56
import typescript from '@rollup/plugin-typescript';
67
import { defineConfig } from 'rollup';
7-
import { terser } from 'rollup-plugin-terser';
88

99
const config = defineConfig([
1010
{

Diff for: packages/sveltekit/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
},
5151
"devDependencies": {
5252
"@sveltejs/kit": "^2.0.2",
53-
"rollup": "^3.20.2",
5453
"svelte": "^4.2.8",
5554
"vite": "^5.0.10"
5655
},

0 commit comments

Comments
 (0)