chore: migrate from webpack to rsbuild#1762
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughReplaces the webpack-based extension build with rsbuild: adds Changes
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed everything up to 9632e09 in 1 minute and 32 seconds. Click for details.
- Reviewed
442lines of code in3files - Skipped
3files when reviewing. - Skipped posting
1draft 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, suggestinganyas 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, suggestinganycould be worse than letting TypeScript infer the type. The comment suggests usinganywhich 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 likeanycould be more harmful than helpful. The comment should be deleted since it suggests usinganytype which is an anti-pattern, and we don't have enough context to suggest the correct type.
Workflow ID: wflow_7fTSEYcqlGvMs1bA
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| extensions: [".ts", ".js"], | ||
| }, | ||
| tools: { | ||
| rspack: (config) => { |
There was a problem hiding this comment.
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.
| rspack: (config) => { | |
| rspack: (config: any): any => { |
This comment was generated because it violated a code review rule: mrule_lKhrJQCKUgYAxwcS.
There was a problem hiding this comment.
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.
⛔ Files ignored due to path filters (1)
package-lock.jsonis 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.jsonare already correct:
"beginsPattern": "^.*build started.*"matches Rsbuild's actual output- The suggestion to make patterns case-insensitive (
[Bb]uild) is unnecessaryThe 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.
| "watch": "concurrently \"npm:watch --prefix ./webview_panels\" \"rsbuild build --mode development --watch\"", | ||
| "test-compile": "tsc -p ./", |
There was a problem hiding this comment.
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.
| 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", | ||
| ]; |
There was a problem hiding this comment.
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.
| 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>
9632e09 to
9c73462
Compare
| } | ||
| 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.
This comment was marked as outdated.
Sorry, something went wrong.
Bundle Size Reportdarwin-arm64: 70.0 MB
linux-x64: 71.7 MB
win32-x64: 72.7 MB
|
There was a problem hiding this comment.
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"inconfig.externalsdoes not set the externals type; it externalizes a module literally named"commonjs". Setconfig.externalsType = "commonjs"(orcommonjs2) and keep only real package names inconfig.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
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
.vscode/launch.json.vscode/tasks.jsonpackage.jsonrsbuild.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
| for (const { from, to } of patterns) { | ||
| try { | ||
| cpSync(from, to, { recursive: true }); | ||
| } catch (error) { | ||
| console.error(`Failed to copy ${from}:`, (error as Error).message); | ||
| } | ||
| } |
There was a problem hiding this comment.
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).
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>
| 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.
This comment was marked as outdated.
Sorry, something went wrong.
ralphstodomingo
left a comment
There was a problem hiding this comment.
only the docker-setup changes are blocking
| rspack: (config) => { | ||
| config.externals = [ | ||
| "vscode", | ||
| "commonjs", |
There was a problem hiding this comment.
claude flags this on my end, saying there's no package with that name. Might be worth a check.
- 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>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
rsbuild.config.ts (1)
209-227:⚠️ Potential issue | 🔴 CriticalSet
externalsTypeso externals emit CommonJS requires.
config.externalsis still missing an explicit CommonJS external type. Rspack’s default isvar, which can emit global lookups instead ofrequire(...)forvscode,zeromq, and the native packages.Suggested fix
tools: { rspack: (config) => { + config.externalsType = "commonjs"; config.externals = [ "vscode",Reference: Rspack’s
externalsTypedocs list the default asvarand supportcommonjs: 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
| @@ -0,0 +1,255 @@ | |||
| import { defineConfig, RsbuildPlugin } from "@rsbuild/core"; | |||
| import { cpSync, existsSync, readdirSync } from "fs"; | |||
There was a problem hiding this comment.
🧩 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 -80Repository: 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.
There was a problem hiding this comment.
fs.cpSync auto-creates missing parent directories for file destinations, both with and without recursive: true, no?
There was a problem hiding this comment.
@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
🤖 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
Checklist
README.mdupdated and added information about my changeImportant
Migrate build system from Webpack to rsbuild, updating configuration and scripts, and removing Webpack dependencies.
@rsbuild/corefor main extension build.rsbuild.config.tsfor configuration with TypeScript decorator support viats-loader.package.jsonscripts to usersbuild(e.g.,build,watch).webpack,webpack-cli,copy-webpack-plugin,terser-webpack-plugin,webpack-shell-plugin-next.@rsbuild/coretodevDependencies..vscode/launch.jsonandtasks.jsonfor rsbuild compatibility.rsbuild.config.ts.This description was created by
for 9632e09. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit
Chores
Documentation