#Build astro for no-server

24 messages · Page 1 of 1 (latest)

tranquil quartz
#

Hello,

I was wondering if it is possible to build astro as a no-server build, meaning that if I just click on the index.html, the page displays correctly with all the functionality. I have searched the documentation but have not found that option. I am evaluating to use starlight as the template for the documentation.

Thank you,

chilly basalt
#

Hi. In the astro config, you should be able to set
output: "static"
to build a static website

#

This should also default to static if you don't set the config value for output

royal grove
#

do you mean 'serverless' ? like lambda ?

tranquil quartz
#

Thank you. Same problem. I think I can be more specific and that somehow I found the problem, but do not know how to fix it. What I want is to access starlight from file://. I have seen that all paths for css and js are absolute. Changing them to relative fixes the problem of .css, but not for .js, as I get a CORS error (moreover, the "origin" header is null). Is there any option I can change? I have seen https://docs.astro.build/en/reference/configuration-reference/#buildformat but I do not think is this one.

Astro Documentation

Build faster websites with less client-side JavaScript.

tranquil quartz
royal grove
#

I see, this came up many times before, let me search the history.

tranquil quartz
#

oh, thank you

#

It is weird we do not have a name for this kind of "serverless" anymore

royal grove
#

I confused, but your use case is clear, that is like offline opening files in browser.

tranquil quartz
#

yep

royal grove
tranquil quartz
royal grove
#

unfortunately, it seems to be not supported.

tranquil quartz
#

I see

royal grove
tranquil quartz
#

ok

#

I understand

#

Thank you for your help

royal grove
#

you're welcome, I think "without server" helped find it. If you want to expose your use case, maybe there could be more solutions, I think one reason that intentionally supposed not to work, is security, as browsing files that reference other files cannot be accessed by your browser, which can only see the file you explicitely opened.

#

so building everything inside html, although feasible, was not followed up as it's like swimming against the current 😉 quite hard.

tranquil quartz
#

yep, I understand

#

It is okay, I will find another way.