Skip to content

[plugin vite:asset] TypeError: The "path" argument must be of type string. Received undefined #235

Closed
@KieranP

Description

@KieranP

Describe the bug

I get the following error after switching a large Svelte/SCSS application to Rolldown-vite:

[plugin vite:asset]
TypeError: The "path" argument must be of type string. Received undefined
TypeError [PLUGIN_ERROR]: The "path" argument must be of type string. Received undefined
    at basename (node:path:1404:5)
    at Object.assetFileNames (file:///Volumes/Xpand/xpand/node_modules/vite-plugin-ruby/dist/index.js:269:23)
    at PluginContextImpl.getAssetFileNames (file:///Volumes/Xpand/xpand/node_modules/rolldown/dist/shared/src-Dwb_rX9h.mjs:2761:91)
    at PluginContextImpl.emitFile (file:///Volumes/Xpand/xpand/node_modules/rolldown/dist/shared/src-Dwb_rX9h.mjs:2753:51)
    at fileToBuiltUrl (file:///Volumes/Xpand/xpand/node_modules/vite/node_modules/rolldown-vite/dist/node/chunks/dep-BVD1pq3j.js:7861:39)
    at async PluginContextImpl.handler (file:///Volumes/Xpand/xpand/node_modules/vite/node_modules/rolldown-vite/dist/node/chunks/dep-BVD1pq3j.js:7708:19)
    at async plugin (file:///Volumes/Xpand/xpand/node_modules/rolldown/dist/shared/src-Dwb_rX9h.mjs:2942:16)
    at async plugin.<computed> (file:///Volumes/Xpand/xpand/node_modules/rolldown/dist/shared/src-Dwb_rX9h.mjs:3800:12)

Looks like vite-plugin-ruby might be relying on something Rolldown-vite has removed/lost during the changes?

Reproduction

TODO (difficult because it also relies on a configured Ruby on Rails application using vite-plugin-ruby to replicate)

Steps to reproduce

Given the following:

entrypoints/themes/client1.ts

import '@styles/themes/client1.scss'

stylesheets/themes/client1.scss

@use './base';

stylesheets/themes/base.scss

:root {
  --body-font-family: sans-serif;
}

System Info

System:
    OS: macOS 15.5
    CPU: (12) arm64 Apple M3 Pro
    Memory: 127.63 MB / 18.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.15.1 - ~/.asdf/installs/nodejs/22.15.1/bin/node
    Yarn: 4.9.1 - /opt/homebrew/bin/yarn
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
  Browsers:
    Chrome: 137.0.7151.69
    Safari: 18.5
  npmPackages:
    rolldown-vite:  6.3.18

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions