Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When executing vite build
with the alphaTab
plugin I get an error. I don't experience any issues when I run it in development mode using the vite
command. The error when running vite build
looks like this:
vite v4.5.3 building for production...
✓ 100 modules transformed.
✓ built in 610ms
[vite-plugin-alphatab-url] plugins is not a function
file: E:/code/dawn/node_modules/@coderline/alphatab/dist/alphaTab.mjs
error during build:
TypeError: plugins is not a function
at bundleWorkerEntry (E:\code\dawn\node_modules\@coderline\alphatab\dist\alphaTab.vite.js:1688:24)
at async workerFileToUrl (E:\code\dawn\node_modules\@coderline\alphatab\dist\alphaTab.vite.js:1654:29)
at async Object.transform (E:\code\dawn\node_modules\@coderline\alphatab\dist\alphaTab.vite.js:1852:32)
at async transform (file:///E:/code/dawn/node_modules/rollup/dist/es/shared/node-entry.js:24449:16)
at async ModuleLoader.addModuleSource (file:///E:/code/dawn/node_modules/rollup/dist/es/shared/node-entry.js:24649:30)
The relevant piece of code in in alphaTab.vite.js
looks like this:
const bundle = await rollup({
...rollupOptions,
input,
// plugins seems to be missing here
plugins: await plugins(newBundleChain),
preserveEntrySignatures: false
});
Expected Behavior
The build to successfully complete
Steps To Reproduce
My config is pretty simple (it's a typescript project):
I'm trying to build using:
vite build
This is my vite.config.ts
file
import { defineConfig } from 'vite'
import { alphaTab } from '@coderline/alphatab/vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [alphaTab(), react()],
appType: 'spa',
})
And this is how I import alphatab:
// In one file:
import { AlphaTabApi, synth } from '@coderline/alphatab'
// In another file, just typings:
import type { CoreSettings, PlayerSettings } from '@coderline/alphatab'
Link to jsFiddle, CodePen, Project
I don't know if this can be demonstrated on jsfiddle or codepen, but I made a very simple repro repo:
https://github.com/bali182/alphatab-vite-build-bug-repro
Found in Version
1.3
Platform
Web
Environment
- **OS**: Win 11 Home
- **Browser**: Not relevant
- **.net Version**: Not relevant
Anything else?
No response