curi
curi copied to clipboard
@curi/static and svelte
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 ?
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.
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 ?
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.
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
Is there any docs for svelte usage?
https://curi.js.org/guides/svelte/