tidalcycles / strudel

Web-based environment for live coding algorithmic patterns, incorporating a faithful port of TidalCycles to JavaScript
https://strudel.cc/
GNU Affero General Public License v3.0
579 stars 105 forks source link

Fix clock worker dependency path in module builds #1129

Closed mindofmatthew closed 1 week ago

mindofmatthew commented 2 weeks ago

The neocyclist clock worker import (added in 1.1.0) doesn't work in individually-published modules. When bundling those modules for publication, Vite transforms the clock worker import to the following, which is incorrect:

new SharedWorker(new URL("/assets/clockworker--4w5RvGG.js", import.meta.url))

It should be "./assets/..." so that it resolves relative to the package script, rather than the root url. This causes two separate issues:

This affects the @strudel/core package and the other two packages which re-package the core (@strudel/repl and @strudel/web). Specifying "./" as the base path for these packages solves the problem. Diffing the dist files verified that this change didn't have any other consequences for the build.

mindofmatthew commented 2 weeks ago

Since this is a regression, and a showstopper for including these packages with a bundler, it would be great if we could push this out as a v1.1.1 patch :crossed_fingers: