Skip to content

chore: migrate from webpack to rsbuild#1762

Merged
mdesmet merged 4 commits intomasterfrom
chore/migrate-to-rsbuild
Apr 20, 2026
Merged

chore: migrate from webpack to rsbuild#1762
mdesmet merged 4 commits intomasterfrom
chore/migrate-to-rsbuild

Conversation

@mdesmet
Copy link
Copy Markdown
Contributor

@mdesmet mdesmet commented Oct 20, 2025

  • Replace webpack with @rsbuild/core for main extension build
  • Create rsbuild.config.ts with TypeScript decorator support via ts-loader
  • Update package.json scripts (webpack → build, watch mode updated)
  • Remove webpack dependencies: webpack, webpack-cli, copy-webpack-plugin, terser-webpack-plugin, webpack-shell-plugin-next
  • Update .vscode/launch.json and tasks.json for rsbuild compatibility
  • Maintain webview panels build with Vite (no changes)
  • Configure proper externals, source maps, and file copying for Python scripts
  • Production build size: ~2.1 MB (optimized)

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Overview

Problem

Describe the problem you are solving. Mention the ticket/issue if applicable.

Solution

Describe the implemented solution. Add external references if needed.

Screenshot/Demo

A picture is worth a thousand words. Please highlight the changes if applicable.

How to test

  • Steps to be followed to verify the solution or code changes
  • Mention if there is any settings configuration added/changed/deleted

Checklist

  • I have run this code and it appears to resolve the stated issue
  • README.md updated and added information about my change

Important

Migrate build system from Webpack to rsbuild, updating configuration and scripts, and removing Webpack dependencies.

  • Build System Migration:
    • Replace Webpack with @rsbuild/core for main extension build.
    • Add rsbuild.config.ts for configuration with TypeScript decorator support via ts-loader.
    • Update package.json scripts to use rsbuild (e.g., build, watch).
  • Dependencies:
    • Remove Webpack-related dependencies: webpack, webpack-cli, copy-webpack-plugin, terser-webpack-plugin, webpack-shell-plugin-next.
    • Add @rsbuild/core to devDependencies.
  • Configuration:
    • Update .vscode/launch.json and tasks.json for rsbuild compatibility.
    • Maintain webview panels build with Vite (no changes).
    • Configure externals, source maps, and file copying for Python scripts in rsbuild.config.ts.
  • Misc:
    • Production build size is approximately 2.1 MB (optimized).

This description was created by Ellipsis for 9632e09. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Chores

    • Migrated build system from webpack to rsbuild; added new build/build-dev scripts, replaced webpack scripts, and added @rsbuild/core.
    • Introduced rsbuild configuration including asset-copying and platform binary handling.
    • Removed the old webpack configuration file.
    • Updated IDE launch configuration and background task start/end detection for the new build flow.
  • Documentation

    • Updated docker setup docs and deploy script to reflect the new build/watch commands.

@mdesmet mdesmet requested a review from saravmajestic October 20, 2025 02:11
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Oct 20, 2025

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Replaces the webpack-based extension build with rsbuild: adds rsbuild.config.ts (including a copy-assets plugin), updates package scripts/devDependencies, adjusts VS Code task/launch settings, removes webpack.config.js, and updates docker helper docs/scripts to use npm run build.

Changes

Cohort / File(s) Summary
VS Code configs
\.vscode/launch.json, \.vscode/tasks.json
Changed debug preLaunchTask from npm: webpacknpm: build; updated background task beginsPattern/endsPattern to match rsbuild-style build log lines.
Package scripts & deps
package.json
Replaced webpack scripts with build/build-dev invoking rsbuild; vscode:prepublish now runs rsbuild build; added @rsbuild/core to devDependencies; removed webpack-related devDependencies and webpack scripts; updated watch to use rsbuild.
New rsbuild config & plugin
rsbuild.config.ts
Added RSBuild config exporting default build settings for ./src/extension.tsdist/, rspack customizations (externals, node options, ts-loader), chunk strategy, and a copy-assets-plugin that copies Python runtime assets, native deps, zeromq (best-effort), @altimateai/* packages, and platform-specific .node binaries into dist/.
Bundler removal
webpack.config.js
Removed entire webpack configuration file and its exported configuration array.
Docker helper updates
docker-setup/README.md, docker-setup/deploy.sh
Swapped references and commands from npm run webpack/webpack watch to npm run build/generic rebuild/watch messaging; adjusted script comments and banners.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer
  participant VSCode as VS Code
  participant RSBuild as rsbuild
  participant Plugin as copyAssetsPlugin
  participant FS as Filesystem

  Dev->>VSCode: start debug or run "npm run build"
  VSCode->>RSBuild: invoke build command
  RSBuild->>Plugin: onBeforeBuild hook
  Plugin->>FS: copy Python assets, native packages, platform `.node` files, node_modules pieces
  Plugin-->>RSBuild: report copied files / warnings
  RSBuild-->>VSCode: build finished
  VSCode-->>Dev: launch extension host / complete
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • saravmajestic
  • ralphstodomingo
  • dev-punia-altimate
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description includes a bullet-point summary of changes and detailed information, but the template sections (Problem, Solution, Screenshot/Demo, How to test) remain largely empty placeholders with no actual content filled in, and the checklist items are unchecked. Complete the template sections with actual content: describe the problem being solved, the solution implemented, testing steps, and check the checklist items. Remove placeholder text.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: migrating the build system from webpack to rsbuild, which is the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/migrate-to-rsbuild

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed everything up to 9632e09 in 1 minute and 32 seconds. Click for details.
  • Reviewed 442 lines of code in 3 files
  • Skipped 3 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. rsbuild.config.ts:96
  • Draft comment:
    Consider adding an explicit type annotation for the 'api' parameter in the plugin's setup callback to improve clarity and maintainability.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% One of the additional rules emphasizes providing return types for utility functions. While this isn't exactly about return types, type annotations in TypeScript generally improve code clarity and maintainability. However, suggesting any as a type is actually an anti-pattern in TypeScript as it defeats the purpose of type safety. Without knowing the actual type from the rsbuild API, suggesting any could be worse than letting TypeScript infer the type. The comment suggests using any which is generally discouraged in TypeScript. Without access to rsbuild's type definitions, we can't be certain of the correct type to use. While type annotations are generally good, suggesting an incorrect or overly permissive type like any could be more harmful than helpful. The comment should be deleted since it suggests using any type which is an anti-pattern, and we don't have enough context to suggest the correct type.

Workflow ID: wflow_7fTSEYcqlGvMs1bA

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Comment thread rsbuild.config.ts
extensions: [".ts", ".js"],
},
tools: {
rspack: (config) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an explicit return type for the rspack callback function. For instance, annotate the parameter and return type (e.g., (config: any): any => { ... }) to improve type safety and ease future refactoring.

Suggested change
rspack: (config) => {
rspack: (config: any): any => {

This comment was generated because it violated a code review rule: mrule_lKhrJQCKUgYAxwcS.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (5)
package.json (1)

1366-1366: Remove leftover webpack-era dependency.

file-loader is unused with Rsbuild; safe to drop.

-    "file-loader": "^6.1.0",
rsbuild.config.ts (4)

53-57: Prefer output.library.type over deprecated libraryTarget.

Rspack/Webpack 5 style is library: { type: "commonjs2" }.

-      config.output = {
-        ...config.output,
-        libraryTarget: "commonjs2",
-        devtoolModuleFilenameTemplate: "../[resource-path]",
-      };
+      config.output = {
+        ...config.output,
+        library: { type: "commonjs2" },
+        devtoolModuleFilenameTemplate: "../[resource-path]",
+      };

63-71: Rule filter is brittle; may remove unrelated rules.

Filtering any rule whose test contains “ts” can also drop combined JS/TS rules. Narrow the predicate to only ts/tsx.

-      config.module.rules = config.module.rules.filter((rule: any) => {
-        if (typeof rule === "object" && rule.test) {
-          const testStr = rule.test.toString();
-          return !testStr.includes("ts");
-        }
-        return true;
-      });
+      const isTsTest = (test: unknown) =>
+        test instanceof RegExp && /\\.[cm]?tsx?$/.test(test.source || "");
+      config.module.rules = config.module.rules.filter((rule: any) => {
+        return !(rule && rule.test && isTsTest(rule.test));
+      });

73-81: ts-loader options for decorators and speed.

If you rely on legacy decorators/metadata (Inversify), ensure tsconfig has experimentalDecorators and emitDecoratorMetadata. Consider transpileOnly:true + separate type-check for faster watch.

       config.module.rules.push({
         test: /\.ts$/,
         exclude: /(node_modules|src\/test)/,
         use: [
           {
             loader: "ts-loader",
+            options: {
+              transpileOnly: true
+            },
           },
         ],
       });

Confirm fork-ts-checker is not required in your flow; otherwise keep full type-check in loader.


141-157: Make module copy paths robust across package managers.

Hardcoding ./node_modules may break with workspaces/PnP. Derive paths via require.resolve.

-            const notebookModules = [
-              "./node_modules/zeromq",
-              "./node_modules/@aminya/node-gyp-build",
-              "./node_modules/node-gyp-build",
-            ];
+            const notebookModules = [
+              path.dirname(require.resolve("zeromq/package.json")),
+              path.dirname(require.resolve("@aminya/node-gyp-build/package.json")),
+              path.dirname(require.resolve("node-gyp-build/package.json")),
+            ];

Also compute destPath using path.join("dist","node_modules",pkgName) rather than string replace to avoid OS-specific issues.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 158fab7 and 9632e09.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • .vscode/launch.json (1 hunks)
  • .vscode/tasks.json (1 hunks)
  • package.json (3 hunks)
  • rsbuild.config.ts (1 hunks)
  • webpack.config.js (0 hunks)
💤 Files with no reviewable changes (1)
  • webpack.config.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: test (windows-latest)
  • GitHub Check: test (macos-latest)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
.vscode/launch.json (1)

15-15: Switch to “npm: build” looks correct.

Matches the new build script and dist path. No further changes needed here.

package.json (2)

1324-1324: Double-check prepublish pipeline still valid.

You swapped webpack for rsbuild, but still invoke prepareBuild.js. Ensure it doesn’t rely on webpack artifacts.

If needed, I can adapt prepareBuild.js to the new Rsbuild outputs.


1345-1345: Node version requirement for Rsbuild 1.5.x.

Ensure CI/dev use Node >= 18.12.0, otherwise builds may fail. Based on learnings.

If your workflows pin an older Node, update them accordingly.

rsbuild.config.ts (1)

20-22: Validate sourceMap setting.

If output.sourceMap.js expects boolean or "source-map" is unsupported in your Rsbuild version, switch to true or the documented enum. Based on learnings.

Run rsbuild inspect to confirm the generated devtool/source map settings.

.vscode/tasks.json (1)

23-24: Review comment is incorrect—current patterns already match Rsbuild's actual output.

The Rsbuild CLI prints "build started" using logger.start, which is lowercase. The current patterns in .vscode/tasks.json are already correct:

  • "beginsPattern": "^.*build started.*" matches Rsbuild's actual output
  • The suggestion to make patterns case-insensitive ([Bb]uild) is unnecessary

The review comment incorrectly claims Rsbuild outputs capitalized "Build started" and "Built in …", but the evidence shows Rsbuild emits lowercase "build started". No changes are required.

Likely an incorrect or invalid review comment.

Comment thread package.json
Comment on lines +1326 to 1327
"watch": "concurrently \"npm:watch --prefix ./webview_panels\" \"rsbuild build --mode development --watch\"",
"test-compile": "tsc -p ./",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Broken watch command: “npm:watch” is not a shell command.

concurrently executes shell commands; the “npm:” prefix is a VS Code tasks label, not executable. Watch will fail, breaking debug-task.

Apply this fix:

-    "watch": "concurrently \"npm:watch --prefix ./webview_panels\" \"rsbuild build --mode development --watch\"",
+    "watch": "concurrently \"npm run watch --prefix ./webview_panels\" \"rsbuild build --mode development --watch\"",
🤖 Prompt for AI Agents
In package.json around lines 1326-1327, the "watch" script uses the invalid
command "npm:watch" (a VS Code task label) which fails when run by concurrently;
change it to call the npm script runner, e.g. replace "npm:watch --prefix
./webview_panels" with "npm run watch --prefix ./webview_panels" (or
alternatively "cd ./webview_panels && npm run watch") so concurrently executes a
real shell command and the debug/watch task works.

Comment thread rsbuild.config.ts
Comment on lines +34 to +45
config.externals = [
"vscode",
"commonjs",
// These dependencies are ignored because we don't use them, and App Insights has try-catch protecting their loading if they don't exist
// See: https://github.com/microsoft/vscode-extension-telemetry/issues/41#issuecomment-598852991
"applicationinsights-native-metrics",
"@opentelemetry/tracing",
"@azure/opentelemetry-instrumentation-azure-sdk",
"@opentelemetry/instrumentation",
"@azure/functions-core",
"zeromq",
];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Incorrect externals: literal "commonjs" included; externals type not set.

Including "commonjs" in the array externalizes a non-existent module. Set externalsType and remove it to ensure vscode/zeromq resolve correctly at runtime.

-      config.externals = [
-        "vscode",
-        "commonjs",
-        // These dependencies are ignored because we don't use them, and App Insights has try-catch protecting their loading if they don't exist
-        // See: https://github.com/microsoft/vscode-extension-telemetry/issues/41#issuecomment-598852991
-        "applicationinsights-native-metrics",
-        "@opentelemetry/tracing",
-        "@azure/opentelemetry-instrumentation-azure-sdk",
-        "@opentelemetry/instrumentation",
-        "@azure/functions-core",
-        "zeromq",
-      ];
+      // Ensure CommonJS externalization for Node/VSC extension host
+      config.externalsType = "commonjs";
+      config.externals = [
+        "vscode",
+        "applicationinsights-native-metrics",
+        "@opentelemetry/tracing",
+        "@azure/opentelemetry-instrumentation-azure-sdk",
+        "@opentelemetry/instrumentation",
+        "@azure/functions-core",
+        "zeromq",
+      ];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
config.externals = [
"vscode",
"commonjs",
// These dependencies are ignored because we don't use them, and App Insights has try-catch protecting their loading if they don't exist
// See: https://github.com/microsoft/vscode-extension-telemetry/issues/41#issuecomment-598852991
"applicationinsights-native-metrics",
"@opentelemetry/tracing",
"@azure/opentelemetry-instrumentation-azure-sdk",
"@opentelemetry/instrumentation",
"@azure/functions-core",
"zeromq",
];
// Ensure CommonJS externalization for Node/VSC extension host
config.externalsType = "commonjs";
config.externals = [
"vscode",
"applicationinsights-native-metrics",
"@opentelemetry/tracing",
"@azure/opentelemetry-instrumentation-azure-sdk",
"@opentelemetry/instrumentation",
"@azure/functions-core",
"zeromq",
];
🤖 Prompt for AI Agents
In rsbuild.config.ts around lines 34 to 45, remove the literal "commonjs" from
the config.externals array and set the externals type explicitly (e.g.,
config.externalsType = "commonjs" or "commonjs2") so external modules like
"vscode" and "zeromq" are resolved correctly at runtime; keep the listed module
names in the externals array but do not include the string "commonjs".

Replace webpack with @rsbuild/core for the extension bundle. rsbuild
runs on rspack (Rust) and is ~1.7x faster than the previous webpack +
terser pipeline (~3.3s vs ~5.6s locally), while producing a smaller
readable bundle (~2.38 MB vs ~2.90 MB).

- New rsbuild.config.ts mirrors the webpack config: same externals,
  same ts-loader (preserves inversify decorators + emitDecoratorMetadata),
  same Python and @altimateai/altimate-core native-module copy logic.
- output.minify uses SWC with mangle: false + keep_classnames/keep_fnames
  to match the previous terser "readable minify" behavior and keep stack
  traces actionable.
- chunkSplit: all-in-one; dynamic imports still split identically to
  webpack (e.g. node-fetch multipart-parser).
- Drop webpack, webpack-cli, webpack-shell-plugin-next, copy-webpack-plugin,
  terser-webpack-plugin; add @rsbuild/core.
- Rename `npm run webpack*` scripts to `build`/`build-dev`; update
  .vscode/launch.json preLaunchTask and tasks.json problem-matcher
  patterns to rsbuild's `build started` / `built in` output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mdesmet mdesmet force-pushed the chore/migrate-to-rsbuild branch from 9632e09 to 9c73462 Compare April 20, 2026 04:56
@mdesmet mdesmet requested a review from ralphstodomingo April 20, 2026 05:00
Comment thread rsbuild.config.ts
}
for (const file of readdirSync(srcDir)) {
if (file.endsWith(".node")) {
cpSync(path.join(srcDir, file), path.join(coreDistDir, file));

This comment was marked as outdated.

@github-actions
Copy link
Copy Markdown

Bundle Size Report

darwin-arm64: 70.0 MB
Category Size Compressed Files
Native: altimate-core 35.1 MB 14.0 MB 1
Media assets 29.6 MB 25.8 MB 91
Webview JS bundles 26.1 MB 8.3 MB 343
Native: zeromq 20.5 MB 8.2 MB 15
Webview images 15.3 MB 12.2 MB 18
Extension backend (JS) 2.3 MB 0.5 MB 1
Python packages 2.0 MB 0.5 MB 95
Native: other node_modules 1.0 MB 0.2 MB 139
Webview CSS 0.8 MB 0.1 MB 2
Webview other 0.5 MB 0.1 MB 5
Other 0.1 MB 26 KB 15
Total 133.2 MB 69.9 MB 725
linux-x64: 71.7 MB
Category Size Compressed Files
Native: altimate-core 41.8 MB 15.1 MB 1
Media assets 29.6 MB 25.8 MB 91
Webview JS bundles 26.1 MB 8.3 MB 343
Native: zeromq 21.9 MB 8.7 MB 16
Webview images 15.3 MB 12.2 MB 18
Extension backend (JS) 2.3 MB 0.5 MB 1
Python packages 2.0 MB 0.5 MB 95
Native: other node_modules 1.0 MB 0.2 MB 139
Webview CSS 0.8 MB 0.1 MB 2
Webview other 0.5 MB 0.1 MB 5
Other 0.1 MB 26 KB 15
Total 141.3 MB 71.6 MB 726
win32-x64: 72.7 MB
Category Size Compressed Files
Native: altimate-core 50.3 MB 16.2 MB 1
Media assets 29.6 MB 25.8 MB 91
Webview JS bundles 26.1 MB 8.3 MB 343
Native: zeromq 20.0 MB 8.1 MB 15
Webview images 15.3 MB 12.2 MB 18
Extension backend (JS) 2.3 MB 0.5 MB 1
Native: other node_modules 2.3 MB 0.7 MB 147
Python packages 2.0 MB 0.5 MB 95
Webview CSS 0.8 MB 0.1 MB 2
Webview other 0.5 MB 0.1 MB 5
Other 0.1 MB 26 KB 15
Total 149.1 MB 72.5 MB 733

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
rsbuild.config.ts (1)

199-217: ⚠️ Potential issue | 🔴 Critical

"commonjs" is still being treated as an external module name.

This is the same unresolved blocker from the earlier review. Putting "commonjs" in config.externals does not set the externals type; it externalizes a module literally named "commonjs". Set config.externalsType = "commonjs" (or commonjs2) and keep only real package names in config.externals.

In Rspack/Webpack, does adding the string `"commonjs"` inside `config.externals` set the externals type, or does it externalize a module literally named `"commonjs"`? What is the correct configuration for CommonJS externals on a Node-targeted bundle?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rsbuild.config.ts` around lines 199 - 217, The externals array is incorrectly
containing the literal string "commonjs" (which externalizes a module named
"commonjs") instead of setting the externals format; remove "commonjs" from
config.externals, add or set config.externalsType = "commonjs" (or "commonjs2"
if appropriate for your runtime), and keep only actual package names in
config.externals (refer to the config.externals and config.externalsType symbols
to locate where to make the change).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rsbuild.config.ts`:
- Around line 52-58: The current try/catch around cpSync (in the loop over
patterns) is swallowing failures and only logging them; change the catch to fail
the build for required assets by rethrowing the error (or calling
process.exit(1)) instead of console.error so missing Python/native artifacts
abort the build; leave warn-only behavior only for truly optional packages and
apply the same fix to the other identical try/catch instances that use
cpSync/patterns (the other catch blocks flagged in the review).
- Around line 71-76: The copy currently uses
require.resolve("@altimateai/core/") which resolves to the entry file, so cpSync
copies a single file; instead resolve the package directory (e.g., with
path.dirname(require.resolve("@altimateai/core/package.json"))) and pass that
directory to cpSync so the entire package folder is copied into path.join(DIST,
"node_modules/@altimateai/core"); update the cpSync source from
require.resolve("@altimateai/core/") to the computed packageDir and keep
existing options and error handling.

---

Duplicate comments:
In `@rsbuild.config.ts`:
- Around line 199-217: The externals array is incorrectly containing the literal
string "commonjs" (which externalizes a module named "commonjs") instead of
setting the externals format; remove "commonjs" from config.externals, add or
set config.externalsType = "commonjs" (or "commonjs2" if appropriate for your
runtime), and keep only actual package names in config.externals (refer to the
config.externals and config.externalsType symbols to locate where to make the
change).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9905332d-cfe6-447a-9357-42cba85d0450

📥 Commits

Reviewing files that changed from the base of the PR and between 9632e09 and 9c73462.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .vscode/launch.json
  • .vscode/tasks.json
  • package.json
  • rsbuild.config.ts
✅ Files skipped from review due to trivial changes (2)
  • .vscode/tasks.json
  • .vscode/launch.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json

Comment thread rsbuild.config.ts
Comment on lines +52 to +58
for (const { from, to } of patterns) {
try {
cpSync(from, to, { recursive: true });
} catch (error) {
console.error(`Failed to copy ${from}:`, (error as Error).message);
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Don’t downgrade required asset-copy failures to warnings.

These catch blocks let the build succeed with missing Python/native artifacts. That turns packaging problems into delayed runtime failures; for example, src/lib/index.js:485-487 does a runtime require("zeromq"), so a skipped copy here produces a VSIX that only breaks once users hit that path. Fail hard for required assets and keep warn-only behavior for genuinely optional packages.

Also applies to: 67-69, 77-79, 88-91, 123-125, 139-140

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rsbuild.config.ts` around lines 52 - 58, The current try/catch around cpSync
(in the loop over patterns) is swallowing failures and only logging them; change
the catch to fail the build for required assets by rethrowing the error (or
calling process.exit(1)) instead of console.error so missing Python/native
artifacts abort the build; leave warn-only behavior only for truly optional
packages and apply the same fix to the other identical try/catch instances that
use cpSync/patterns (the other catch blocks flagged in the review).

Comment thread rsbuild.config.ts
require.resolve("@altimateai/core/") returns the package's main entry
file (e.g., dist/index.js), not the package directory. Passing a file
path to cpSync with a directory destination would copy just the entry
file, not the whole package.

Use path.dirname(require.resolve("@altimateai/core/package.json"))
to get the actual package directory. When the package is not installed,
require.resolve throws MODULE_NOT_FOUND, which the existing try/catch
still handles (same "Skipping @altimateai/core" warning as before).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread rsbuild.config.ts
Comment on lines +52 to +58
for (const { from, to } of patterns) {
try {
cpSync(from, to, { recursive: true });
} catch (error) {
console.error(`Failed to copy ${from}:`, (error as Error).message);
}
}

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@ralphstodomingo ralphstodomingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only the docker-setup changes are blocking

Comment thread package.json
Comment thread rsbuild.config.ts Outdated
rspack: (config) => {
config.externals = [
"vscode",
"commonjs",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude flags this on my end, saying there's no package with that name. Might be worth a check.

mdesmet and others added 2 commits April 20, 2026 13:54
- docker-setup/deploy.sh + README.md: update webpack references to
  the new `npm run build` script and drop "webpack" from watch-mode
  language. deploy.sh had been calling the removed `npm run webpack`
  script.
- rsbuild.config.ts: drop the bare "commonjs" entry from externals.
  In webpack/rspack, strings in the externals array are module names,
  not output-format specifiers. The line was leftover noise from the
  old webpack config and was never functional. The Node externals type
  is implied by `output.target: "node"`, so no replacement needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The cpSync loop over `patterns` (Python bridge, notebook kernel, and
@altimateai/dbt-integration Python packages) was swallowing failures
and only logging them. That was a regression vs. master's webpack
config, which used CopyPlugin with its default `noErrorOnMissing: false`
— missing sources aborted the build.

Rethrow a descriptive Error on copy failure so rsbuild reports "Failed
to build" and exits non-zero. Verified empirically: removing
altimate_notebook_kernel.py now causes `npx rsbuild build` to exit 1
with a clear "Required asset missing: ..." message.

The other try/catches (zeromq, @altimateai/core, @altimateai/altimate-core,
per-platform .node binaries, node-gyp-build) remain warn-only, matching
the equivalent WebpackShellPluginNext block on master — those are either
expected-to-miss-on-some-platforms or legacy optional deps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
rsbuild.config.ts (1)

209-227: ⚠️ Potential issue | 🔴 Critical

Set externalsType so externals emit CommonJS requires.

config.externals is still missing an explicit CommonJS external type. Rspack’s default is var, which can emit global lookups instead of require(...) for vscode, zeromq, and the native packages.

Suggested fix
   tools: {
     rspack: (config) => {
+      config.externalsType = "commonjs";
       config.externals = [
         "vscode",

Reference: Rspack’s externalsType docs list the default as var and support commonjs: https://rspack.dev/config/externals#externalstype

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rsbuild.config.ts` around lines 209 - 227, Rspack externals are currently
listed via rspack: (config) => { config.externals = [...] } but no externals
type is set, causing rspack to emit globals (default "var") instead of CommonJS
requires; update the rspack config function to set config.externalsType =
"commonjs" (or the equivalent property supported by rspack) alongside
config.externals so packages like "vscode", "zeromq" and the native
`@altimateai/`* modules are emitted as require(...) calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rsbuild.config.ts`:
- Line 2: The copy loop is failing on clean builds because cpSync doesn't create
destination parent directories; before each cpSync call in the loop that
processes files into "dist/altimate_python_packages" ensure the destination
parent exists by using path.dirname(dest) and mkdirSync(..., { recursive: true
}) (import path and mkdirSync if not present) so that the parent directory is
created prior to cpSync; update the code surrounding the cpSync calls to compute
dest, create its parent dir, then perform cpSync.

---

Duplicate comments:
In `@rsbuild.config.ts`:
- Around line 209-227: Rspack externals are currently listed via rspack:
(config) => { config.externals = [...] } but no externals type is set, causing
rspack to emit globals (default "var") instead of CommonJS requires; update the
rspack config function to set config.externalsType = "commonjs" (or the
equivalent property supported by rspack) alongside config.externals so packages
like "vscode", "zeromq" and the native `@altimateai/`* modules are emitted as
require(...) calls.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85b84332-f027-44dd-b752-ee1634857a93

📥 Commits

Reviewing files that changed from the base of the PR and between f071fb9 and d816221.

📒 Files selected for processing (1)
  • rsbuild.config.ts

Comment thread rsbuild.config.ts
@@ -0,0 +1,255 @@
import { defineConfig, RsbuildPlugin } from "@rsbuild/core";
import { cpSync, existsSync, readdirSync } from "fs";
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, locate and examine the rsbuild.config.ts file
git ls-files | grep -i "rsbuild.config"

Repository: AltimateAI/vscode-dbt-power-user

Length of output: 93


🏁 Script executed:

# Read the imports section and the asset copy loop
cat -n rsbuild.config.ts | head -80

Repository: AltimateAI/vscode-dbt-power-user

Length of output: 3252


Create destination parents before required file copies.

On a clean build, dist/altimate_python_packages may not exist, causing file copies to fail. The loop at lines 56-65 copies files to nested paths like dist/altimate_python_packages/altimate_notebook_kernel.py, but cpSync does not create missing parent directories for file destinations. Create the parent directory before each copy.

Suggested fix
-import { cpSync, existsSync, readdirSync } from "fs";
+import { cpSync, existsSync, mkdirSync, readdirSync } from "fs";
 import path from "path";
       for (const { from, to } of patterns) {
         try {
+          mkdirSync(path.dirname(to), { recursive: true });
           cpSync(from, to, { recursive: true });
         } catch (error) {
           throw new Error(
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rsbuild.config.ts` at line 2, The copy loop is failing on clean builds
because cpSync doesn't create destination parent directories; before each cpSync
call in the loop that processes files into "dist/altimate_python_packages"
ensure the destination parent exists by using path.dirname(dest) and
mkdirSync(..., { recursive: true }) (import path and mkdirSync if not present)
so that the parent directory is created prior to cpSync; update the code
surrounding the cpSync calls to compute dest, create its parent dir, then
perform cpSync.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fs.cpSync auto-creates missing parent directories for file destinations, both with and without recursive: true, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ralphstodomingo — you're right to push back on this. Let me clarify the exact behavior:

For directory-to-directory copies with { recursive: true }, cpSync does create the destination directory itself. So cpSync('src/altimate_python_packages', 'dist/altimate_python_packages', { recursive: true }) will create dist/altimate_python_packages if it doesn't exist, provided dist/ itself exists (which rsbuild ensures).

However, there is a caveat for file-to-file copies: cpSync doesn't automatically create parent directories when copying a single file — you'd get an ENOENT error if the parent doesn't exist. So if any of the patterns in the loop are copying individual files (e.g., cpSync('kernel.py', 'dist/altimate_python_packages/kernel.py')), the parent dist/altimate_python_packages/ must already exist.

Looking at the AI-generated summary for rsbuild.config.ts, the patterns appear to copy the Python kernel file and dbt-integration files into dist/. If those are file → file copies where the destination parent is a directory that isn't guaranteed to exist beforehand, the concern still applies. But if they're all dir → dir copies, then cpSync with { recursive: true } handles it correctly and my original suggestion was overstated.

Could you confirm whether all the patterns in that copy loop are directory-to-directory, or if any of them are single-file copies? That would determine whether the mkdirSync guard is actually needed.


🧠 Learnings used
Learnt from: mdesmet
Repo: AltimateAI/vscode-dbt-power-user PR: 1825
File: src/commands/walkthroughCommands.ts:199-201
Timestamp: 2026-03-12T04:51:13.221Z
Learning: In `src/commands/walkthroughCommands.ts`, the walkthrough install commands (`installDbtFusion`, `installDbtCloud`, `installDbtCore`) should resolve the active workspace folder from the workspace state key `"dbtPowerUser.projectSelected"` (a `ProjectQuickPickItem` with a `uri` property) using `workspace.getWorkspaceFolder(pickedProject.uri)`, matching the same pattern used by `validateProjects` and `installDeps`. The resolved folder should be passed to `pythonEnvironment.getEnvironmentVariables(workspaceFolder)` instead of hardcoding `workspace.workspaceFolders?.[0]`.

Learnt from: CR
Repo: AltimateAI/vscode-dbt-power-user PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-02T09:13:46.680Z
Learning: Applies to package.json : Export extension configuration through comprehensive settings with 190+ configuration options covering dbt mode, query limits, AI features, and lineage options

Learnt from: CR
Repo: AltimateAI/vscode-dbt-power-user PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-02T09:13:46.680Z
Learning: Applies to jest.config.js : Use Jest for unit testing with ts-jest configuration, custom VSCode API mocks, and Istanbul-based coverage reporting

Learnt from: CR
Repo: AltimateAI/vscode-dbt-power-user PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-02T09:13:46.680Z
Learning: Applies to webpack.config.js : Use Webpack for main extension build process with development and production build configurations

@mdesmet mdesmet merged commit 2293dcb into master Apr 20, 2026
21 checks passed
@mdesmet mdesmet deleted the chore/migrate-to-rsbuild branch April 20, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants