CoderLine/alphaTab

vite build does not work with alphaTab's worker

fheyen opened this issue · 2 comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm importing alphaTab as a node module in a svelte/vite project ().

While the developing mode works fine, building leads to the following error:

Unexpected early exit. This happens when Promises returned by plugins cannot resolve. 
Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "[...]/visual-guitar-tab-comparison/visual-guitar-tab-comparison/node_modules/@coderline/alphatab/dist/alphaTab.mjs"
error during build:
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. 
Unfinished hook action(s) on exit:
(vite:worker-import-meta-url) transform "[...]/visual-guitar-tab-comparison/visual-guitar-tab-comparison/node_modules/@coderline/alphatab/dist/alphaTab.mjs"
    at process.handleBeforeExit (file:///[...]/visual-guitar-tab-comparison/visual-guitar-tab-comparison/node_modules/rollup/dist/es/shared/node-entry.js:25902:28)
    at Object.onceWrapper (node:events:629:26)
    at process.emit (node:events:514:28)

I suspect this happens because the worker file is not imported in the way that rollup expects it to be.

I created a minimal example.

Expected Behavior

vite build works without error

Steps To Reproduce

  1. Check out https://github.com/visvar/visual-guitar-tab-comparison
  2. cd build-reproduce
  3. npm install
  4. npm run build

Link to jsFiddle, CodePen, Project

https://github.com/visvar/visual-guitar-tab-comparison

Found in Version

1.3-alpha

Platform

Node.js

Environment

- **OS**: Windows 10
- **Node**: 20.8.1
- **vite**: 4.5.0

Anything else?

No response

I will probably have to include alphaTab as <script> then.

As you linked to https://www.alphatab.net/docs/reference/settings/core/scriptfile/ ... I tried this option but could not find the file for the web worker, which one is it?