-
I just started using Svelte template with TS. It is awesome, and I love it. <head>
<title>My App</title>
<!-- JQuery (In General) -->
<script src="./src/assets/libs/jquery.js"></script>
<!-- Fomantic-UI -->
<link href="./src/assets/libs/fomantic-ui/fomantic-ui.css" rel="stylesheet">
<script src="./src/assets/libs/fomantic-ui/fomantic-ui.js"></script>
</head> ... in Svelte on the other hands, it would fail (404 file not found or jQuery is not defined...) when I build the application (not at dev tho). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Please search for the keyword "svelte:head", that might be what you are looking for. |
Beta Was this translation helpful? Give feedback.
-
I finally I solved this issue by using
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!!!! |
Beta Was this translation helpful? Give feedback.
I finally I solved this issue by using
import inject from '@rollup/plugin-inject';
For everyone who still want to use UMD libs in a modern framework!!!!