lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.33k stars 70 forks source link

jquery in svelte #43

Closed KememChan closed 1 year ago

KememChan commented 1 year ago

how can i use jquery in svelte template?

lisonge commented 1 year ago

emmm, you can use jquery and all packages from npm just like the following code

pnpm add jquery
# npm install -S jquery
# yarn add jquery
<script lang="ts">
  import $ from 'jquery'; // add this line
</script>

<main>

</main>

<style>

</style>
KememChan commented 1 year ago

The $ prefix is reserved, and cannot be used for variable and import namessvelte(illegal-declaration)

lisonge commented 1 year ago

you can use import Jquery from 'jquery';