OiO.lk Blog javascript Make JavaScript eval vite import aware
javascript

Make JavaScript eval vite import aware


I would like to evaluate snippets of JavaScript (to implement a REPL for a dialect of ClojureScript) in a project that runs vite.

Vite translates code like import 'joi' to import '/node_modules/.vite/deps/joi.js?v=53669cbc' but in my snippets I don’t know how to make this translation.

It would be very handy if vite had some endpoint where I could just send the import to, like:

/@resolve-at-runtime/joi

so in my compiler I would just have to add a small prefix to make this work.

Is there such a thing, perhaps as a plugin? Perhaps other approaches that could work?



You need to sign in to view this answers

Exit mobile version