Migration to Vite/Vitest and elimination of require
When using your brilliant vue-plugin for our package StippleLatex.jl via umd file, I stumbled across the require not found issue #59.
After I couldn't get rid of it easily with the current setup of vue-katex, partly due to outdated packages, I decided to migrate the plugin to Vite and spend myself a learning in Vue/Vite/Vitest.
I did some renaming according to Vite's recommendation and updated all packages to their latest versions that were available for Vue-2. I also moved deepmerge to the external packages as that blew up the umd file from 3 to 200 kB.
Currently the output files are named vite-plugin-katex.es.js and vite-plugin-katex.umd.js.
@lucpotage @shadskii
As I am a complete beginner in Vue/Vite, I'd be happy if you could comment on this PR. In particular, I am not sure whether it was a good choice to move deepmerge to external.
Nevertheless, I hope that this PR can make the development of a future Vue-3 plugin easier.
My learnings or biggest road blocks during development were:
vi.spyOn() needs asynchronous import and will only work if you import the identical path and not only the identical file as the component you are testing.
using the alias @ for ./src makes testing much easier as it prevents referencing the correct file via two different paths
Migration to Vite/Vitest and elimination of
require
When using your brilliant vue-plugin for our package
StippleLatex.jl
via umd file, I stumbled across therequire not found issue
#59.After I couldn't get rid of it easily with the current setup of
vue-katex
, partly due to outdated packages, I decided to migrate the plugin to Vite and spend myself a learning in Vue/Vite/Vitest.I did some renaming according to Vite's recommendation and updated all packages to their latest versions that were available for Vue-2. I also moved
deepmerge
to the external packages as that blew up the umd file from 3 to 200 kB.Currently the output files are named
vite-plugin-katex.es.js
andvite-plugin-katex.umd.js
.@lucpotage @shadskii
As I am a complete beginner in Vue/Vite, I'd be happy if you could comment on this PR. In particular, I am not sure whether it was a good choice to move
deepmerge
to external.Nevertheless, I hope that this PR can make the development of a future Vue-3 plugin easier.
My learnings or biggest road blocks during development were:
vi.spyOn()
needs asynchronous import and will only work if you import the identical path and not only the identical file as the component you are testing.@
for./src
makes testing much easier as it prevents referencing the correct file via two different paths