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

NextJS: How to access files in production deployment #6

Open
timtnleeProject opened this issue Sep 14, 2021 · 0 comments
Open

NextJS: How to access files in production deployment #6

timtnleeProject opened this issue Sep 14, 2021 · 0 comments
Labels

Comments

@timtnleeProject
Copy link
Collaborator

Problem

My nextJS Apis have accessed some config files through the file system,
for example, the /posts folder under the project root.

import fs from "fs";
import path from "path";

const postsDirectory = path.join(process.cwd(), "posts");

const filenames = fs.readdirSync(postsDirectory); // failed in deployment

However, the folder structure has been optimized(? and is not as same as local development and local build.

So basically the /posts folder isn't there in the deployed environment.

Solution

vercel/next.js#8251 (comment)

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

No branches or pull requests

1 participant