Skip to content

Commit

Permalink
feat(build): Update Rollup to v4 (#11087)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
timfish and mydea authored Mar 14, 2024
1 parent 0f1ea2f commit 7054190
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 226 deletions.
4 changes: 4 additions & 0 deletions dev-packages/rollup-utils/npmHelpers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export function makeBaseNPMConfig(options = {}) {

sourcemap: true,

// Include __esModule property when generating exports
// Before the upgrade to Rollup 4 this was included by default and when it was gone it broke tests
esModule: true,

// output individual files rather than one big bundle
preserveModules: true,

Expand Down
2 changes: 1 addition & 1 deletion dev-packages/rollup-utils/plugins/bundlePlugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import * as childProcess from 'child_process';
import commonjs from '@rollup/plugin-commonjs';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import terser from '@rollup/plugin-terser';
import license from 'rollup-plugin-license';
import { terser } from 'rollup-plugin-terser';

/**
* Create a plugin to add an identification banner to the top of stand-alone bundles.
Expand Down
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@
],
"devDependencies": {
"@biomejs/biome": "^1.4.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.1",
"@rollup/plugin-sucrase": "^4.0.3",
"@rollup/plugin-typescript": "^8.3.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-sucrase": "^5.0.2",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
"@size-limit/file": "~11.0.1",
"@size-limit/webpack": "~11.0.1",
"@strictsoftware/typedoc-plugin-monorepo": "^0.3.1",
Expand Down Expand Up @@ -120,10 +121,9 @@
"prettier": "^3.1.1",
"replace-in-file": "^4.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.67.1",
"rollup-plugin-cleanup": "3.2.1",
"rollup-plugin-license": "^2.6.1",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^4.13.0",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-license": "^3.3.1",
"sinon": "^7.3.2",
"size-limit": "~11.0.1",
"ts-jest": "^27.1.4",
Expand All @@ -134,7 +134,8 @@
"yalc": "^1.0.0-pre.53"
},
"resolutions": {
"**/agent-base": "5",
"wrap-ansi": "7.0.0",
"string-width": "4.1.0",
"**/terser/source-map": "0.7.4"
},
"version": "0.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
},
"devDependencies": {
"astro": "^3.5.0",
"rollup": "^3.20.2",
"vite": "4.0.5"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"deno-types": "node ./scripts/download-deno-types.mjs",
"build": "run-s build:transpile build:types",
"build:dev": "yarn build",
"build:transpile": "yarn deno-types && rollup -c rollup.config.js",
"build:transpile": "yarn deno-types && rollup -c rollup.config.mjs",
"build:types": "run-s deno-types build:types:tsc build:types:bundle",
"build:types:tsc": "tsc -p tsconfig.types.json",
"build:types:bundle": "rollup -c rollup.types.config.mjs",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@sentry/webpack-plugin": "2.14.3",
"chalk": "3.0.0",
"resolve": "1.22.8",
"rollup": "2.78.0",
"rollup": "3.29.4",
"stacktrace-parser": "^0.1.10"
},
"devDependencies": {
Expand Down
4 changes: 3 additions & 1 deletion packages/node-experimental/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
"@sentry/core": "8.0.0-alpha.2",
"@sentry/opentelemetry": "8.0.0-alpha.2",
"@sentry/types": "8.0.0-alpha.2",
"@sentry/utils": "8.0.0-alpha.2",
"@sentry/utils": "8.0.0-alpha.2"
},
"devDependencies": {
"@types/node": "14.18.63"
},
"optionalDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/replay-worker/rollup.examples.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import { terser } from 'rollup-plugin-terser';

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

Expand Down
2 changes: 1 addition & 1 deletion packages/replay-worker/rollup.worker.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import { terser } from 'rollup-plugin-terser';

const config = defineConfig([
{
Expand Down
1 change: 0 additions & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
},
"devDependencies": {
"@sveltejs/kit": "^2.0.2",
"rollup": "^3.20.2",
"svelte": "^4.2.8",
"vite": "^5.0.10"
},
Expand Down
Loading

0 comments on commit 7054190

Please sign in to comment.