curi icon indicating copy to clipboard operation
curi copied to clipboard

@curi/static and svelte

Open wighawag opened this issue 4 years ago • 6 comments

I'd like to use @curi/static to generate the index.html for each pages I am using rollup to generate the bundle so I added a plugin function that call staticFiles But for that I need to import the routes, which in turn import the component. Since these component are svelte files, roll up complain with

[!] Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
src\pages\index.svelte (1:0)
1: <script>
   ^
...
Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error ...

Do you have an svelte example using @curi/static ?

wighawag avatar Jun 16 '20 22:06 wighawag

rollup-plugin-svelte doesn't take care of those for you?

I'm going to be AFK for a few days, but if that doesn't work, I'll try to play around with this a bit next week. I need to give some more attention to both the svelte and static packages.

pshrmn avatar Jun 17 '20 05:06 pshrmn

I am using that plugin, but It is not enabled in the rollup.config.js itself so when I import my routes file it does not know how to process these svelte file. Maybe I could do it in 2 phases and load the bundled js somehow ?

wighawag avatar Jun 17 '20 09:06 wighawag

I'm finally looking into this today, but I don't have an immediate answer. I think that I'll have to look into how Sapper works to figure out a solution.

pshrmn avatar Jun 28 '20 20:06 pshrmn

Cool,

From what I gather sapper crawl the pages, by first having a server running the app

There is also routify (https://routify.dev) whose approach is to use jsdom (https://github.com/jsdom/jsdom) to instantiate the app and generate the pre-render

wighawag avatar Jun 28 '20 20:06 wighawag

Is there any docs for svelte usage?

quantuminformation avatar Nov 20 '20 10:11 quantuminformation

https://curi.js.org/guides/svelte/

pshrmn avatar Nov 21 '20 14:11 pshrmn