Skip to content

Commit 5bc0232

Browse files
committed
test: More bundler versions
1 parent 958248e commit 5bc0232

File tree

4 files changed

+379
-7
lines changed

4 files changed

+379
-7
lines changed

Diff for: .github/workflows/checks.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ jobs:
125125
# "10.24.1",
126126
# vite uses optional chaining which isn't compatible with node 12
127127
# "12.22.12",
128-
"14.21.1",
129-
"16.18.1",
130-
"18.12.1",
128+
"14",
129+
"16",
130+
"18",
131+
"20",
132+
"22"
131133
]
132134
os: [ubuntu-latest, windows-latest]
133135
runs-on: ${{ matrix.os }}

Diff for: packages/integration-tests/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
"react": "^18.2.0",
4040
"react-dom": "^18.2.0",
4141
"rollup": "3.2.0",
42+
"rollup4": "npm:rollup@^4",
4243
"ts-node": "^10.9.1",
4344
"vite": "3.0.0",
45+
"vite6": "npm:vite@^6",
4446
"webpack4": "npm:webpack@^4",
4547
"webpack5": "npm:[email protected]"
4648
},

Diff for: packages/integration-tests/utils/create-cjs-bundles.ts

+42-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as vite from "vite";
2+
import * as vite6 from "vite6";
23
import * as path from "path";
34
import * as rollup from "rollup";
5+
import * as rollup4 from "rollup4";
46
import { default as webpack4 } from "webpack4";
57
import { webpack as webpack5 } from "webpack5";
68
import * as esbuild from "esbuild";
@@ -10,14 +12,15 @@ import { sentryWebpackPlugin } from "@sentry/webpack-plugin";
1012
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
1113
import { sentryRollupPlugin } from "@sentry/rollup-plugin";
1214

13-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
14-
const nodejsMajorversion = process.version.split(".")[0]!.slice(1);
15+
const [NODE_MAJOR_VERSION] = process.version.split(".").map(Number) as [number];
16+
17+
type Bundlers = "webpack4" | "webpack5" | "esbuild" | "rollup" | "rollup4" | "vite" | "vite6";
1518

1619
export function createCjsBundles(
1720
entrypoints: { [name: string]: string },
1821
outFolder: string,
1922
sentryUnpluginOptions: Options,
20-
plugins: string[] = []
23+
plugins: Bundlers[] = []
2124
): void {
2225
if (plugins.length === 0 || plugins.includes("vite")) {
2326
void vite.build({
@@ -36,6 +39,25 @@ export function createCjsBundles(
3639
plugins: [sentryVitePlugin(sentryUnpluginOptions)],
3740
});
3841
}
42+
43+
if (plugins.length === 0 || plugins.includes("vite6")) {
44+
void vite6.build({
45+
clearScreen: false,
46+
build: {
47+
sourcemap: true,
48+
outDir: path.join(outFolder, "vite"),
49+
rollupOptions: {
50+
input: entrypoints,
51+
output: {
52+
format: "cjs",
53+
entryFileNames: "[name].js",
54+
},
55+
},
56+
},
57+
plugins: [sentryVitePlugin(sentryUnpluginOptions)],
58+
});
59+
}
60+
3961
if (plugins.length === 0 || plugins.includes("rollup")) {
4062
void rollup
4163
.rollup({
@@ -52,6 +74,22 @@ export function createCjsBundles(
5274
);
5375
}
5476

77+
if (NODE_MAJOR_VERSION >= 18 && plugins.length === 0 || plugins.includes("rollup4")) {
78+
void rollup4
79+
.rollup({
80+
input: entrypoints,
81+
plugins: [sentryRollupPlugin(sentryUnpluginOptions)],
82+
})
83+
.then((bundle) =>
84+
bundle.write({
85+
sourcemap: true,
86+
dir: path.join(outFolder, "rollup"),
87+
format: "cjs",
88+
exports: "named",
89+
})
90+
);
91+
}
92+
5593
if (plugins.length === 0 || plugins.includes("esbuild")) {
5694
void esbuild.build({
5795
sourcemap: true,
@@ -65,7 +103,7 @@ export function createCjsBundles(
65103
}
66104

67105
// Webpack 4 doesn't work on Node.js versions >= 18
68-
if (parseInt(nodejsMajorversion) < 18 && (plugins.length === 0 || plugins.includes("webpack4"))) {
106+
if (NODE_MAJOR_VERSION < 18 && (plugins.length === 0 || plugins.includes("webpack4"))) {
69107
webpack4(
70108
{
71109
devtool: "source-map",

0 commit comments

Comments
 (0)