Skip to content

How To Include Other JS Libs in Svelte-TS-Template? #1970

Answered by KiddoV
KiddoV asked this question in Q&A
Discussion options

You must be logged in to vote

I finally I solved this issue by using import inject from '@rollup/plugin-inject';

  • vite.config.ts
import {defineConfig} from 'vite';
import {svelte} from '@sveltejs/vite-plugin-svelte';
import inject from '@rollup/plugin-inject';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    inject({
      $: "jquery",
      jQuery: "jquery",
      "window.jQuery": "jquery"
  }),
  svelte()],
})

For everyone who still want to use UMD libs in a modern framework!!!!

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@KiddoV
Comment options

@leaanthony
Comment options

@KiddoV
Comment options

@KiddoV
Comment options

@KiddoV
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by KiddoV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants