You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/docs/25-build-and-deploy/80-adapter-netlify.md
+24-3Lines changed: 24 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,8 +107,29 @@ Additionally, you can add your own Netlify functions by creating a directory for
107
107
directory = "functions"
108
108
```
109
109
110
-
## Troubleshooting
111
-
112
110
### Accessing the file system
113
111
114
-
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.
112
+
You can [use files in Netlify Serverless Functions](https://www.netlify.com/blog/2021/08/12/how-to-include-files-in-netlify-serverless-functions/).
113
+
114
+
```js
115
+
// @errors: 2307 7031
116
+
/// file: +server.js
117
+
importfsfrom"node:fs";
118
+
importpathfrom"node:path";
119
+
import { dev } from'$app/environment';
120
+
121
+
// importing a static asset will return the resolved path in the production build
Copy file name to clipboardExpand all lines: documentation/docs/25-build-and-deploy/90-adapter-vercel.md
+20-3Lines changed: 20 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -153,8 +153,25 @@ If you have Vercel functions contained in the `api` directory at the project's r
153
153
154
154
Projects created before a certain date may default to using an older Node version than what SvelteKit currently requires. You can [change the Node version in your project settings](https://vercel.com/docs/concepts/functions/serverless-functions/runtimes/node-js#node.js-version).
155
155
156
-
## Troubleshooting
157
-
158
156
### Accessing the file system
159
157
160
-
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.
158
+
You can [use files in Serverless Functions on Vercel](https://vercel.com/guides/how-can-i-use-files-in-serverless-functions).
159
+
160
+
```js
161
+
// @errors: 2307 7031
162
+
/// file: api/pdf/+server.js
163
+
importfsfrom"node:fs";
164
+
importpathfrom"node:path";
165
+
166
+
// importing a static asset will return the resolved path in the production build
0 commit comments