MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / adjustScriptPathsPlugin

Function adjustScriptPathsPlugin

packages/alphatab/vite.config.ts:14–31  ·  view source on GitHub ↗
(min: boolean)

Source from the content-addressed store, hash-verified

12
13// ensure we have file extensions in the URL worker resolve area
14const adjustScriptPathsPlugin = (min: boolean) => {
15 return {
16 name: 'adjust-script-paths',
17 renderChunk(code) {
18 const modifiedCode = new MagicString(code);
19 const extension = min ? '.min.mjs' : '.mjs';
20 modifiedCode.replaceAll(
21 /(@coderline\/alphatab|\.)\/alphaTab\.(core|worker|worklet)(\.ts)?(['"])/g,
22 `./alphaTab.$2${extension}$4`
23 );
24
25 return {
26 code: modifiedCode.toString(),
27 map: modifiedCode.generateMap()
28 };
29 }
30 } satisfies Plugin;
31};
32
33// Rolldown unconditionally lowers top-level `class X { ... }` declarations to
34// `var X = class { ... };` (documented as TDZ-hoisting behaviour, independent

Callers 1

vite.config.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected