Closed martinklepsch closed 4 months ago
Yeah I think so too. Just need to understand the servers module graph and how these cljs modules that are transformed get registered there. Is this event.file
similar to the id
that we use in the transformation, is that the id
that is used.
Somebody also said this in Discord
I wonder if you might want something more like this then. https://rollupjs.org/plugin-development/#resolveid. Essentially, resolve it to a .js extension id with a query string. Load the correct extension when you see that query string, and transform when you see that query string.
I think that would allow other js transformers to also do their thing, without you having to call other transformers explicitly.
Edit
You need the
enforce: 'pre'
option set on the plugin forresolveId
to work.
@martinklepsch now that I went through the learning curve that comment makes so much more sense than it did the first time I read it. The vite dev mode also really helped make things clear what was going on within the black box (turned this on in the dev project)
This is resolved in https://github.com/squint-cljs/vite-plugin-squint/pull/13
Can this be closed since #13 is merged? cc @martinklepsch
I don't fully grasp the details yet but I found this code from a haxe vite plugin. Could be that's all thats needed:
https://github.com/ciscoheat/vite-plugin-haxe/blob/2cb147281285ca533b1d21da625718538db5d7a5/src/index.ts#L42-L54