Skip to content

revert: Testing additional bundlers #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "3.2.0",
"rollup4": "npm:rollup@^4",
"ts-node": "^10.9.1",
"vite": "3.0.0",
"vite6": "npm:vite@^6",
"webpack4": "npm:webpack@^4",
"webpack5": "npm:[email protected]"
},
Expand Down
62 changes: 6 additions & 56 deletions packages/integration-tests/utils/create-cjs-bundles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as vite3 from "vite";
import * as vite from "vite";
import * as path from "path";
import * as rollup3 from "rollup";
import * as rollup from "rollup";
import { default as webpack4 } from "webpack4";
import { webpack as webpack5 } from "webpack5";
import * as esbuild from "esbuild";
Expand All @@ -10,17 +10,9 @@ import { sentryWebpackPlugin } from "@sentry/webpack-plugin";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
import { sentryRollupPlugin } from "@sentry/rollup-plugin";

const [NODE_MAJOR_VERSION] = process.version.split(".").map(Number) as [number];
const [NODE_MAJOR_VERSION] = process.version.replace("v", "").split(".").map(Number) as [number];

type Bundlers =
| "webpack4"
| "webpack5"
| "esbuild"
| "rollup"
| "rollup4"
| "vite"
| "vite6"
| string;
type Bundlers = "webpack4" | "webpack5" | "esbuild" | "rollup" | "vite" | string;

export function createCjsBundles(
entrypoints: { [name: string]: string },
Expand All @@ -29,29 +21,7 @@ export function createCjsBundles(
plugins: Bundlers[] = []
): void {
if (plugins.length === 0 || plugins.includes("vite")) {
void vite3.build({
clearScreen: false,
build: {
sourcemap: true,
outDir: path.join(outFolder, "vite"),
rollupOptions: {
input: entrypoints,
output: {
format: "cjs",
entryFileNames: "[name].js",
},
},
},
plugins: [sentryVitePlugin(sentryUnpluginOptions)],
});
}

if (NODE_MAJOR_VERSION >= 18 && (plugins.length === 0 || plugins.includes("vite6"))) {
// We can't import this at the top of the file because they are not
// compatible with Node v14
// eslint-disable-next-line @typescript-eslint/no-var-requires
const vite6 = require("vite6") as typeof vite3;
void vite6.build({
void vite.build({
clearScreen: false,
build: {
sourcemap: true,
Expand All @@ -69,27 +39,7 @@ export function createCjsBundles(
}

if (plugins.length === 0 || plugins.includes("rollup")) {
void rollup3
.rollup({
input: entrypoints,
plugins: [sentryRollupPlugin(sentryUnpluginOptions)],
})
.then((bundle) =>
bundle.write({
sourcemap: true,
dir: path.join(outFolder, "rollup"),
format: "cjs",
exports: "named",
})
);
}

if (NODE_MAJOR_VERSION >= 18 && (plugins.length === 0 || plugins.includes("rollup4"))) {
// We can't import this at the top of the file because they are not
// compatible with Node v14
// eslint-disable-next-line @typescript-eslint/no-var-requires
const rollup4 = require("rollup4") as typeof rollup3;
void rollup4
void rollup
.rollup({
input: entrypoints,
plugins: [sentryRollupPlugin(sentryUnpluginOptions)],
Expand Down
Loading
Loading