Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter-static: Check +page.server.js files #10483

Closed
georges-g opened this issue Aug 4, 2023 · 4 comments
Closed

Adapter-static: Check +page.server.js files #10483

georges-g opened this issue Aug 4, 2023 · 4 comments

Comments

@georges-g
Copy link

Describe the problem

I am currently building a website with adapter-static and I have a few routes that use a +page.server.js file.

I can build those routes with the adapter easily if I have:

export let prerender = true;

For each of those +page.server.js.

I also need to have export let ssr = true at the root of my app to make sure the server functions are executed during the generation.

What I find frustrating currently is that, if I forget to have export let prerender = true in one of my +page.server.js, the build is successful, but the app does not work.

Describe the proposed solution

I would like the adapter to check that, if there is a +page.server.js with a load() function, it should have a specific export let prerender = true and export let ssr = true should be also activated.

If not, it should raise an error or a warning.

Alternatives considered

Manual checks

Importance

would make my life easier

Additional Information

No response

@dummdidumm
Copy link
Member

Closing as duplicate of #10332 . Btw you don't need export let ssr = true at the root, that's the default. And you can add export let prerender = true in your root +layout.js so you don't have to write it in each +page.server.js.

@dummdidumm dummdidumm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@georges-g
Copy link
Author

@dummdidumm I think you are mistaken. I have export let prerender = true; in my src/routes/+layout.js but it is not enough. I need to specifically turn it on for my +page.server.js.

@dummdidumm
Copy link
Member

That would be a bug, do you have a reproducible?

Note that +server.js will not inherit the export let prerender = true setting - just in case we're talking about different things.

@georges-g
Copy link
Author

I was talking about +page.server.js, but I tried to recreate the bug in a simple settings and couldn't. Then I checked my main repo and could not reproduce the bug either.

I guess I was in the wrong here, sorry for the false alarm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants