Skip to content

Conversation

@vio
Copy link
Member

@vio vio commented Jun 28, 2025

Summary by CodeRabbit

  • Chores
    • Updated compatibility to support Vite version 7.x.x as a peer dependency.
    • Adjusted test workflows to run in updated package directories and added a new test job for Vite.
    • Added new test packages for Rollup, Rolldown, and Vite with build and test configurations.
    • Added basic test scripts outputting messages to the console.
    • Removed an unused dependency from a test package.

@coderabbitai
Copy link

coderabbitai bot commented Jun 28, 2025

Caution

Review failed

The pull request is closed.

"""

Walkthrough

The peer dependency range for "vite" in package.json was expanded to include version 7.x.x. The CI workflow updated working directories and test commands for rolldown and rollup jobs and added a new job to test Vite across multiple Node.js versions and OSes. New test packages for rolldown, rollup, and vite were added with their own package.json, source files, and tests. The "rolldown" dependency was removed from the rollup test package and added as a separate test package. An obsolete artifact stats.json file was deleted.

Changes

File(s) Change Summary
package.json Expanded "vite" peer dependency to ^7.0.0; reordered exports field; split test:package script into separate scripts for rolldown, rollup, and vite tests.
.github/workflows/ci.yml Updated working directories and test commands for rolldown and rollup jobs; added new test-package-vite job testing multiple Node and OS versions; updated job dependencies.
test/package/rolldown/package.json Added new test package manifest for rolldown with devDependencies and scripts.
test/package/rolldown/rolldown-package.test.js Corrected import path from './rollup.config' to './rolldown.config'.
test/package/rollup/package.json Removed "rolldown" dependency from devDependencies.
test/package/rollup/src/index.js Added new file logging "hello world" to the console.
test/package/vite/package.json Added new test package manifest for vite with devDependencies and ES module type.
test/package/vite/index.html Added new basic HTML file loading vite test script.
test/package/vite/src/index.js Added new file logging "hello world" to the console.
test/package/vite/vite-package.test.js Added new Vitest test suite verifying stats JSON output for various vite build configurations.
test/package/vite/vite.config.js Added multiple Vite build configurations with rollup-plugin-stats plugin and varied output options.
artifacts/stats.json Deleted obsolete JSON stats artifact file.

Possibly related PRs

  • test: Add rolldown tests #166: Adds and configures Rolldown test packages and CI jobs, complementing this PR’s addition of Vite tests and CI jobs, both enhancing test coverage for different bundlers.

Poem

A hop and a skip, a version anew,
Vite seven joins the peer review!
New test packs spring from the ground,
Rollup’s stats and code abound.
Directories shift, dependencies dance,
In code and tests, we take a chance.
🐇✨
"""

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-29T09_29_49_353Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b54948a and 4dd4029.

📒 Files selected for processing (7)
  • .github/workflows/ci.yml (2 hunks)
  • package.json (3 hunks)
  • test/package/vite/index.html (1 hunks)
  • test/package/vite/package.json (1 hunks)
  • test/package/vite/src/index.js (1 hunks)
  • test/package/vite/vite-package.test.js (1 hunks)
  • test/package/vite/vite.config.js (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 0

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

80-82: Range maintenance nitpick – use an upper bound instead of enumerating majors
Enumerating every major (^5 || ^6 || ^7) grows noise over time. A more future-proof expression is:

-    "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
+    "vite": ">=5 <8",

This still blocks breaking Vite 8 while accepting any patch/minor in 5-7, reducing future edits.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5813938 and f4f248b.

📒 Files selected for processing (1)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (1)
package.json (1)

80-82: Confirm real compatibility with Vite 7 before publishing
The widened peer range advertises full support for Vite 7. That’s a contractual promise to downstream users, so please verify:

  1. CI matrix runs the unit/integration tests against vite@7 in addition to 5 & 6.
  2. Manual smoke-test the plugin inside a fresh Vite 7 project to catch API-level breakages (e.g. changes in configResolved, altered Rollup option passthrough).

If fixes are needed, ship them in the same release rather than publishing a range that isn’t actually supported.

@vio vio force-pushed the add-vite-7-support branch 2 times, most recently from 66ab48c to 7a8420c Compare June 28, 2025 17:10
@vio vio force-pushed the add-vite-7-support branch from 7a8420c to 268e020 Compare June 28, 2025 17:15
@socket-security
Copy link

socket-security bot commented Jun 28, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedrolldown@​1.0.0-beta.8 ⏵ 1.0.0-beta.9-commit.d91dfb598 +610073 +198100

View full report

Copy link

@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: 4

🧹 Nitpick comments (3)
test/package/rolldown/package.json (1)

8-8: Update the test script placeholder.

The test script currently outputs an error message and exits with failure. This should be updated to run actual tests once they are implemented.

Do you want me to help generate a proper test script once the test implementation is ready?

test/package/vite/vite-package.test.js (1)

37-37: Simplify path construction using path.resolve.

The current path construction could be simplified and made more robust.

Apply this diff to improve path handling:

-    const actual = await fs.readFile(path.join(relativeFileNameConfig.output.dir, '../artifacts/stats.json'), 'utf8');
+    const actual = await fs.readFile(path.resolve(relativeFileNameConfig.output.dir, '../artifacts/stats.json'), 'utf8');
.github/workflows/ci.yml (1)

196-196: Remove trailing spaces.

There are trailing spaces on this line that should be removed.

Apply this diff to remove trailing spaces:

-          npm install 
+          npm install
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae3abcd and 1144474.

⛔ Files ignored due to path filters (2)
  • test/package/package-lock.json is excluded by !**/package-lock.json
  • test/package/vite/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .github/workflows/ci.yml (2 hunks)
  • artifacts/stats.json (0 hunks)
  • package.json (3 hunks)
  • test/package/rolldown/package.json (1 hunks)
  • test/package/rolldown/rolldown-package.test.js (1 hunks)
  • test/package/rollup/package.json (0 hunks)
  • test/package/rollup/src/index.js (1 hunks)
  • test/package/vite/index.html (1 hunks)
  • test/package/vite/package.json (1 hunks)
  • test/package/vite/src/index.js (1 hunks)
  • test/package/vite/vite-package.test.js (1 hunks)
  • test/package/vite/vite.config.js (1 hunks)
💤 Files with no reviewable changes (2)
  • artifacts/stats.json
  • test/package/rollup/package.json
✅ Files skipped from review due to trivial changes (5)
  • test/package/vite/src/index.js
  • test/package/rolldown/rolldown-package.test.js
  • test/package/vite/index.html
  • test/package/vite/package.json
  • test/package/vite/vite.config.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/package/rollup/src/index.js
  • package.json
🧰 Additional context used
🧬 Code Graph Analysis (1)
test/package/vite/vite-package.test.js (2)
test/unit/fixtures/rollup-stats.ts (1)
  • stats (1-33)
test/package/vite/vite.config.js (6)
  • dynamicOptions (12-21)
  • dynamicOptions (12-21)
  • relativeFileNameConfig (23-33)
  • relativeFileNameConfig (23-33)
  • absoluteFileNameConfig (35-45)
  • absoluteFileNameConfig (35-45)
🪛 actionlint (1.7.7)
.github/workflows/ci.yml

154-154: undefined variable "vite". available variables are "env", "github", "inputs", "job", "matrix", "needs", "runner", "secrets", "steps", "strategy", "vars"

(expression)


170-170: value "19" in "exclude" does not match in matrix "node" combinations. possible values are "22", "20", "18"

(matrix)

🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml

[error] 196-196: trailing spaces

(trailing-spaces)

🔇 Additional comments (9)
test/package/rolldown/package.json (1)

13-14: Dependencies look appropriate for the rolldown test package.

The rolldown beta version and wildcard reference to rollup-plugin-stats are suitable for testing purposes.

test/package/vite/vite-package.test.js (1)

1-7: Import statements and configuration look good.

The imports are properly structured and the configuration imports match the expected usage pattern.

.github/workflows/ci.yml (7)

105-105: Working directory update looks correct.

The working directory change aligns with the new package structure.


108-108: Test script update is appropriate.

The updated script name matches the new package structure.


148-148: Working directory update for rolldown is correct.

Consistent with the package restructuring.


151-151: Test script update for rolldown is appropriate.

Matches the expected naming convention.


197-199: Vite installation and verification steps look good.

The installation and version check commands are appropriate for testing Vite compatibility.


202-202: Test execution command is correct.

The test script name follows the established pattern.


208-208: Dependencies updated correctly.

The new vite test job is properly included in the dependencies.

test('should output stats JSON file with explicit compilation file name', async () => {
await vite(dynamicOptions);

const actual = await fs.readFile(path.join(dynamicOptions.output.dir, 'stats.cjs.json'), 'utf8');
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect file extension in test.

The test expects stats.cjs.json but the configuration shows stats.commonjs.json in the relevant code snippets.

Apply this diff to fix the file extension:

-    const actual = await fs.readFile(path.join(dynamicOptions.output.dir, 'stats.cjs.json'), 'utf8');
+    const actual = await fs.readFile(path.join(dynamicOptions.output.dir, 'stats.commonjs.json'), 'utf8');
📝 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
const actual = await fs.readFile(path.join(dynamicOptions.output.dir, 'stats.cjs.json'), 'utf8');
const actual = await fs.readFile(
path.join(dynamicOptions.output.dir, 'stats.commonjs.json'),
'utf8'
);
🤖 Prompt for AI Agents
In test/package/vite/vite-package.test.js at line 27, the test reads the file
'stats.cjs.json' but the correct filename based on the configuration is
'stats.commonjs.json'. Update the filename in the fs.readFile call to
'stats.commonjs.json' to match the expected output and fix the test.

Comment on lines +10 to +12
beforeEach(() => {
vol.reset();
});
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider adding proper memfs setup.

While vol.reset() clears the in-memory filesystem, ensure that the file system operations in the tests are properly mocked to use memfs instead of the real filesystem.

Verify that the Vite build and file read operations are properly using memfs:


🏁 Script executed:

#!/bin/bash
# Description: Check if memfs is properly configured for file operations
# Expected: Find memfs configuration or mocking setup

rg -A 5 -B 5 "memfs|vol\." test/package/vite/

Length of output: 1132


Add explicit memfs mocking for fs/promises in your Vite tests

We currently reset vol but never redirect Node’s FS API to use memfs, so calls to import fs from 'node:fs/promises' still hit the real disk. To fix:

• In test/package/vite/vite-package.test.js (at the top, before any FS operations):

-import fs from 'node:fs/promises';
 import path from 'node:path';
+import { fs as memfs, vol } from 'memfs';
+import fs from 'node:fs/promises';
 import { describe, test, expect, beforeEach, vi } from 'vitest';
 import { build as vite } from 'vite';
 import config, { dynamicOptions, relativeFileNameConfig, absoluteFileNameConfig } from './vite.config';

+// Redirect all fs/promises calls to memfs
+vi.mock('node:fs/promises', () => memfs.promises);

• Keep your existing reset in beforeEach:

beforeEach(() => {
  vol.reset();
});

With this in place, all file reads/writes in the Vite build and tests will correctly target the in-memory filesystem.

🤖 Prompt for AI Agents
In test/package/vite/vite-package.test.js around lines 10 to 12, you currently
reset the memfs volume but do not mock the 'fs/promises' module to use memfs,
causing file operations to access the real filesystem. To fix this, add an
explicit mock for 'fs/promises' at the top of the file before any filesystem
operations, redirecting it to use memfs. Keep the existing vol.reset() call in
beforeEach to reset the in-memory filesystem between tests.

@vio vio force-pushed the add-vite-7-support branch from 1144474 to 322c5a9 Compare June 29, 2025 08:22
Copy link

@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: 0

🧹 Nitpick comments (2)
.github/workflows/ci.yml (2)

194-198: Remove YAML-lint reported trailing whitespace

yamllint is failing on line 196 due to the extra blank after npm install.
Tidy this up to keep the workflow file clean and avoid CI noise.

-          npm install 
+          npm install

195-199: Consider installing the desired Vite version in one go

Running npm install and then immediately npm install vite@${{ matrix.vite }} --force performs two full installs and leaves package.json out-of-sync. A single, explicit install keeps things faster and reproducible:

-          npm install 
-          npm install vite@${{ matrix.vite }} --force
+          npm ci --ignore-scripts
+          npm install vite@${{ matrix.vite }} --save-exact --no-audit --no-fund

(The first line uses npm ci for deterministic installs; adjust if lock-file is absent.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1144474 and 322c5a9.

⛔ Files ignored due to path filters (1)
  • test/package/vite/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .github/workflows/ci.yml (2 hunks)
  • package.json (3 hunks)
  • test/package/vite/index.html (1 hunks)
  • test/package/vite/package.json (1 hunks)
  • test/package/vite/src/index.js (1 hunks)
  • test/package/vite/vite-package.test.js (1 hunks)
  • test/package/vite/vite.config.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • test/package/vite/vite.config.js
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/package/vite/src/index.js
  • test/package/vite/index.html
  • test/package/vite/package.json
  • test/package/vite/vite-package.test.js
  • package.json
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml

[error] 196-196: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: vite v6 / node 22 / windows-latest
  • GitHub Check: vite v6 / node 18 / ubuntu-latest
  • GitHub Check: vite v5 / node 18 / ubuntu-latest
  • GitHub Check: vite v6 / node 20 / ubuntu-latest
  • GitHub Check: vite v7 / node 20 / ubuntu-latest
  • GitHub Check: vite v6 / node 22 / ubuntu-latest
  • GitHub Check: vite v5 / node 20 / ubuntu-latest
  • GitHub Check: vite v7 / node 22 / windows-latest
  • GitHub Check: vite v5 / node 22 / windows-latest
  • GitHub Check: vite v7 / node 22 / ubuntu-latest
  • GitHub Check: vite v5 / node 22 / ubuntu-latest
  • GitHub Check: rollup v4 / node 18 / ubuntu-latest
  • GitHub Check: rollup v4 / node 20 / ubuntu-latest
  • GitHub Check: rollup v4 / node 22 / windows-latest
  • GitHub Check: rollup v3 / node 22 / windows-latest
  • GitHub Check: rollup v3 / node 22 / ubuntu-latest
  • GitHub Check: rollup v4 / node 22 / ubuntu-latest
  • GitHub Check: rolldown v1 / node 22 / ubuntu-latest
  • GitHub Check: rolldown v1 / node 22 / windows-latest
🔇 Additional comments (1)
.github/workflows/ci.yml (1)

160-166: Double-check that the runner action supports Node 22

All three matrix definitions include "22":

node: ["22", ...]

relative-ci/.github/actions/setup-node-npm@v1.1.0 must recognise that version; otherwise the jobs will fail at setup time.
Please verify that the action (and the underlying actions/setup-node) already ships a Node 22 manifest, or pin to an LTS version (20) until support lands.
Let me know if you want a quick verification script.

Also applies to: 65-66, 118-121

@vio vio force-pushed the add-vite-7-support branch from 322c5a9 to b54948a Compare June 29, 2025 09:24
Copy link

@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)
test/package/vite/vite-package.test.js (1)

1-1: Duplicate comment: memfs mocking issue persists.

The previous review comment about missing memfs mocking for fs/promises is still valid. The current code imports fs from 'node:fs/promises' but doesn't redirect it to use memfs, causing file operations to hit the real filesystem instead of the in-memory filesystem.

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

196-196: Fix trailing spaces.

Static analysis detected trailing spaces on this line.

Apply this diff to remove trailing spaces:

-          npm install 
+          npm install
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 322c5a9 and b54948a.

⛔ Files ignored due to path filters (1)
  • test/package/vite/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .github/workflows/ci.yml (2 hunks)
  • package.json (3 hunks)
  • test/package/vite/index.html (1 hunks)
  • test/package/vite/package.json (1 hunks)
  • test/package/vite/src/index.js (1 hunks)
  • test/package/vite/vite-package.test.js (1 hunks)
  • test/package/vite/vite.config.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • test/package/vite/src/index.js
  • test/package/vite/package.json
  • package.json
  • test/package/vite/vite.config.js
  • test/package/vite/index.html
🧰 Additional context used
🧬 Code Graph Analysis (1)
test/package/vite/vite-package.test.js (2)
test/unit/fixtures/rollup-stats.ts (1)
  • stats (1-33)
test/package/vite/vite.config.js (4)
  • relativeFileNameConfig (25-32)
  • relativeFileNameConfig (25-32)
  • absoluteFileNameConfig (34-41)
  • absoluteFileNameConfig (34-41)
🪛 YAMLlint (1.37.1)
.github/workflows/ci.yml

[error] 196-196: trailing spaces

(trailing-spaces)

🔇 Additional comments (5)
test/package/vite/vite-package.test.js (1)

17-17: No changes needed for output directory property
Verified that vite.config.js’s baseConfig includes an output.dir = 'dist'. Both config.output.dir and relativeFileNameConfig.output.dir correctly reference this property, so no updates are required.

.github/workflows/ci.yml (4)

105-105: Good change: Updated working directories for better isolation.

The working directories have been correctly updated to point to the specific test package subdirectories, improving test isolation and organization.

Also applies to: 148-148


108-108: Good change: Updated test commands for targeted execution.

The test commands now run specific package test scripts, aligning with the new test package structure and allowing for more focused testing.

Also applies to: 151-151


153-203: Well-structured Vite test job with comprehensive matrix.

The new test-package-vite job is well-configured with appropriate matrix combinations and exclusions. The structure follows the existing patterns for rollup and rolldown test jobs.


208-208: Good addition: Updated test dependencies to include Vite testing.

The tests job now correctly depends on all three package test jobs (rollup, rolldown, and vite), ensuring comprehensive testing before proceeding to publish.

test('should output stats JSON file', async () => {
await vite(config);

const actual = await fs.readFile(path.join(__dirname, config.output.dir, 'stats.json'), 'utf8');
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix ES module compatibility issue with __dirname.

The __dirname variable is not available in ES modules. Since this file uses import statements, it's an ES module and needs an alternative approach.

Apply this diff to fix the ES module compatibility:

+import { fileURLToPath } from 'node:url';
+import { dirname } from 'node:path';
+
+const __filename = fileURLToPath(import.meta.url);
+const __dirname = dirname(__filename);

Or alternatively, use a relative path approach if the test working directory is predictable.

📝 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
const actual = await fs.readFile(path.join(__dirname, config.output.dir, 'stats.json'), 'utf8');
import { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const actual = await fs.readFile(path.join(__dirname, config.output.dir, 'stats.json'), 'utf8');
🤖 Prompt for AI Agents
In test/package/vite/vite-package.test.js at line 17, the use of __dirname
causes an ES module compatibility issue because __dirname is not defined in ES
modules. To fix this, replace __dirname with an alternative approach such as
using import.meta.url with the URL and path modules to derive the directory
path, or use a relative path if the test working directory is predictable.
Adjust the path.join call accordingly to ensure the correct file path is
constructed without relying on __dirname.

@vio vio force-pushed the add-vite-7-support branch from b54948a to 4dd4029 Compare June 29, 2025 09:28
@vio vio merged commit 3410bad into master Jun 29, 2025
27 of 28 checks passed
@vio vio deleted the add-vite-7-support branch June 29, 2025 09:31
@coderabbitai coderabbitai bot mentioned this pull request Nov 2, 2025
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