Skip to content

Invalid module ".velite.js" is not a valid package name #360

@xKesvaL

Description

@xKesvaL

Describe the bug

For my personnal website, I am using SvelteKit with Velite for my blog. Dev server has no problem, but on build I get this exact error:

node:internal/event_target:1101
  process.nextTick(() => { throw err; });
                           ^
TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ".velite.js" is not a valid package name imported from C:\Users\[...]\kesval.com\.svelte-kit\output\server\chunks\content.js
    at parsePackageName (node:internal/modules/package_json_reader:211:11)
    at Object.getPackageJSONURL (node:internal/modules/package_json_reader:222:53)
    at packageResolve (node:internal/modules/esm/resolve:768:81)
    at moduleResolve (node:internal/modules/esm/resolve:854:18)
    at defaultResolve (node:internal/modules/esm/resolve:984:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:780:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:704:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:687:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:305:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:175:49) {
  code: 'ERR_INVALID_MODULE_SPECIFIER'
}

When opening that file, at the top, we see :

import { b as __velite_exports } from ".velite.js";

The file .velite.js does exist in the same folder, but I don't think the import syntax is correct.

The output is a whole lot different when building with current vite. We get

import { a as posts, p as projects } from "./index-server.js";

This import instead, which is, different file and different output.

Reproduction

https://github.com/xKesvaL/kesval.com/tree/bug-rolldown-vite

Steps to reproduce

  1. Clone the repo using the bug-rolldown-vite branch.
  2. Install dependencies (bun is configured in package.json)
  3. Launch a build (build command)
    Expect to see the same error.

The main branch uses vite if you need to debug the current output there vs the new one.

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (12) x64 AMD Ryzen 5 8400F 6-Core Processor
    Memory: 6.27 GB / 31.12 GB
  Binaries:
    Node: 22.17.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    bun: 1.2.19 - ~\.bun\bin\bun.EXE
  Browsers:
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    rolldown-vite:  7.1.0

Used Package Manager

bun

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vite

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions