preline icon indicating copy to clipboard operation
preline copied to clipboard

Qwik integration not working in production

Open LazyClicks opened this issue 1 year ago • 4 comments

following the qwik integration guide in preline website and adding this script tag to root.tsx <script src="../assets/vendor/preline/preline.js"></script> results in a not found error when it tries looking for the provided location in dev and prod i way around this is using <script src="../node_modules/preline/preline.js"></script> instead, however that only works in dev in prod i get this Failed to load resource: the server responded with a status of 404 (Not Found) i would like to know if there's a workaround i could use to be able to actually use preline in my qwik project as the library looks fantastic

LazyClicks avatar Jan 30 '24 20:01 LazyClicks

also tried the way it is in the stackblitz qwik repo with <script src="/node_modules/preline/preline.js"></script> but that dioesnt work in prod either

LazyClicks avatar Jan 30 '24 21:01 LazyClicks

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/preline.min.js"></script>

Add the above script inside your body tag.

Adarshvk98 avatar Feb 03 '24 11:02 Adarshvk98

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/preline.min.js"></script>

Add the above script inside your body tag.

won't this just download all of the preline javascript weather the client needs it or not? it seems like a big sacrifice no?

LazyClicks avatar Feb 04 '24 21:02 LazyClicks

okey so after some research and asking the qwik community, the proper way to import preline scripts is like this

import PrelineUI from "../node_modules/preline/preline.js?raw";```

//
//
//

        <script dangerouslySetInnerHTML={PrelineUI as any} />

LazyClicks avatar Feb 12 '24 23:02 LazyClicks