From e7cae202c52c484fad7c5d647389021c19157d33 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Tue, 10 Jan 2023 18:27:28 +0100 Subject: [PATCH] [docs] add note about inability to access file system at runtime Closes #8039 --- .changeset/polite-stingrays-smell.md | 8 ++++++++ packages/adapter-cloudflare-workers/README.md | 6 ++++++ packages/adapter-cloudflare/README.md | 6 ++++++ packages/adapter-netlify/README.md | 6 ++++++ packages/adapter-vercel/README.md | 6 ++++++ 5 files changed, 32 insertions(+) create mode 100644 .changeset/polite-stingrays-smell.md diff --git a/.changeset/polite-stingrays-smell.md b/.changeset/polite-stingrays-smell.md new file mode 100644 index 000000000000..b6e32c870583 --- /dev/null +++ b/.changeset/polite-stingrays-smell.md @@ -0,0 +1,8 @@ +--- +'@sveltejs/adapter-cloudflare': patch +'@sveltejs/adapter-cloudflare-workers': patch +'@sveltejs/adapter-netlify': patch +'@sveltejs/adapter-vercel': patch +--- + +[docs] add note about inability to access file system at runtime diff --git a/packages/adapter-cloudflare-workers/README.md b/packages/adapter-cloudflare-workers/README.md index 05beb435b1aa..d59cff039a6a 100644 --- a/packages/adapter-cloudflare-workers/README.md +++ b/packages/adapter-cloudflare-workers/README.md @@ -111,6 +111,12 @@ declare namespace App { > `platform.env` is only available in the production build. Use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) to test it locally +## Troubleshooting + +### Accessing the file system + +You can't access the file system through methods like `fs.readFileSync` in Serverless/Edge environments. If you need to access files that way, do that during building the app through [prerendering](https://kit.svelte.dev/docs/page-options#prerender). If you have a blog for example and don't want to manage your content through a CMS, then you need to prerender the content (or prerender the endpoint from which you get it) and redeploy your blog everytime you add new content. + ## Changelog [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare-workers/CHANGELOG.md). diff --git a/packages/adapter-cloudflare/README.md b/packages/adapter-cloudflare/README.md index d1ed0857aa31..ccfe906bcd1f 100644 --- a/packages/adapter-cloudflare/README.md +++ b/packages/adapter-cloudflare/README.md @@ -87,6 +87,12 @@ The [`_headers` and `_redirects`](config files) files specific to Cloudflare Pag However, they will have no effect on responses dynamically rendered by SvelteKit, which should return custom headers or redirect responses from [server endpoints](https://kit.svelte.dev/docs/routing#server) or with the [`handle`](https://kit.svelte.dev/docs/hooks#server-hooks-handle) hook. +## Troubleshooting + +### Accessing the file system + +You can't access the file system through methods like `fs.readFileSync` in Serverless/Edge environments. If you need to access files that way, do that during building the app through [prerendering](https://kit.svelte.dev/docs/page-options#prerender). If you have a blog for example and don't want to manage your content through a CMS, then you need to prerender the content (or prerender the endpoint from which you get it) and redeploy your blog everytime you add new content. + ## Changelog [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare/CHANGELOG.md). diff --git a/packages/adapter-netlify/README.md b/packages/adapter-netlify/README.md index 39cfd5a26b34..f6a34c470079 100644 --- a/packages/adapter-netlify/README.md +++ b/packages/adapter-netlify/README.md @@ -104,6 +104,12 @@ Additionally, you can add your own Netlify functions by creating a directory for directory = "functions" ``` +## Troubleshooting + +### Accessing the file system + +You can't access the file system through methods like `fs.readFileSync` in Serverless/Edge environments. If you need to access files that way, do that during building the app through [prerendering](https://kit.svelte.dev/docs/page-options#prerender). If you have a blog for example and don't want to manage your content through a CMS, then you need to prerender the content (or prerender the endpoint from which you get it) and redeploy your blog everytime you add new content. + ## Changelog [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-netlify/CHANGELOG.md). diff --git a/packages/adapter-vercel/README.md b/packages/adapter-vercel/README.md index b0a739c2fe63..5a5e8a2c1b62 100644 --- a/packages/adapter-vercel/README.md +++ b/packages/adapter-vercel/README.md @@ -74,6 +74,12 @@ Projects created before a certain date will default to using Node 14, while Svel ![Vercel project settings](settings.png) +## Troubleshooting + +### Accessing the file system + +You can't access the file system through methods like `fs.readFileSync` in Serverless/Edge environments. If you need to access files that way, do that during building the app through [prerendering](https://kit.svelte.dev/docs/page-options#prerender). If you have a blog for example and don't want to manage your content through a CMS, then you need to prerender the content (or prerender the endpoint from which you get it) and redeploy your blog everytime you add new content. + ## Changelog [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-vercel/CHANGELOG.md).