Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

migrate to vite, replace require by import #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hhaensel
Copy link

@hhaensel hhaensel commented Mar 7, 2023

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant