Skip to content

@coderline/alphatab-vite fails to build under Vite 8 with a rolldown native-binding error, despite peerDependencies claiming Vite 8 support #2768

Description

@magmasystems

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

@coderline/alphatab-vite's package.json declares "vite": "^7 || ^8" in peerDependencies, suggesting Vite 8 is supported. However, adding the alphaTab() plugin to a Vite 8 project's vite.config.ts and running vite build fails every time with a rolldown native-binding error while the plugin is bundling alphaTab's worker entry. This reproduces on both 1.8.3 and 1.8.4.

Expected Behavior

Expected Behavior
Build completes successfully, with the plugin bundling alphaTab's worker/worklet assets as documented.

Actual Behavior
Build fails with:

[plugin vite-plugin-alphatab-url] node_modules/@coderline/alphatab/dist/alphaTab.mjs
Error: Build failed with 1 error:

Error: The function returned undefined, but expected object in
Arc<ThreadsafeFunction<FnArgs<(String, BindingLog)>, Either<Promise<()>, InvalidReturnValue>, FnArgs<(String, BindingLog)>, Status, false, true>>.
at aggregateBindingErrorsIntoJsError (.../@coderline/alphatab-vite/dist/dist.mjs:885:18)
at unwrapBindingResult (.../@coderline/alphatab-vite/dist/dist.mjs:859:128)
at #build (.../@coderline/alphatab-vite/dist/dist.mjs:6327:34)
at async bundleWorkerEntryRolldown (.../@coderline/alphatab-vite/dist/bridge/worker.mjs:162:22)
at async bundleWorkerEntry (.../@coderline/alphatab-vite/dist/bridge/worker.mjs:111:62)
at async workerFileToUrl (.../@coderline/alphatab-vite/dist/bridge/worker.mjs:73:23)
at async TransformPluginContextImpl.transform (.../@coderline/alphatab-vite/dist/importMetaPlugin.mjs:132:29)
...
at #build (.../rolldown/dist/shared/rolldown-build-....mjs:3317:34)
at async buildEnvironment (.../vite/dist/node/chunks/node.js:33018:64)

There's also an accompanying warning during the same build, which may or may not be related:

node_modules/@coderline/alphatab/dist/alphaTab.core.mjs (64771:21) [EMPTY_IMPORT_META] Warning:
import.meta may not be a valid syntax with the iife output format.
const importUrl = import.meta.url;
This import.meta will be replaced with an empty object ({}) automatically.

Steps To Reproduce

  1. Create (or use) a Vite 8 project (vite@8.0.10, which uses rolldown as its bundler).
  2. npm install @coderline/alphatab-vite@1.8.4 --save-dev
  3. Add the plugin to vite.config.ts:
    import { alphaTab } from '@coderline/alphatab-vite';
    
    export default defineConfig({
      plugins: [
        alphaTab(),
        // ...other plugins
      ],
    });

Run npm run build (i.e. vite build).

Link to jsFiddle, CodePen, Project

No response

Version and Environment

- `@coderline/alphatab-vite`: 1.8.4 (also reproduces on 1.8.3)
- `@coderline/alphatab`: 1.8.3
- `vite`: 8.0.10
- `rolldown` (bundled with Vite 8): 1.0.0-rc.17
- Node: v22.22.3
- OS: macOS 24.6.0 (Darwin), x86_64

Platform

Web

Anything else?

Additional Context

The error originates in the plugin's own worker-bundling code (bundleWorkerEntryRolldown), which appears to invoke rolldown's native binding API in a way that's incompatible with the rolldown version Vite 8 bundles (1.0.0-rc.17).

Without the plugin registered at all, the rest of the build succeeds fine — we're currently working around this by manually copying alphaTab's worker/worklet/font/soundfont assets into public/ ourselves and disabling Web Workers for alphaTab (rendering on the main thread instead), which works but is a maintenance burden and a mild performance regression versus the intended worker-based setup.

Happy to provide a minimal reproduction repo if useful.

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions