Next.js Discord

Discord Forum

JS Object Data is not importing in next build, but working in dev server

Unanswered
Burmese posted this in #help-forum
Open in Discord
Avatar
BurmeseOP
https://github.com/Saptarshi-Chakraborty-sb/top-sheet-generator-frontend
Above is the link of the GitHub repository of my project. I have changed some settings in the project to export this as a static side and I don't need any server. So that I can upload the Website in any free static site serving platform (like, Cloudflare Pages).

Here I am exporting some data as a JS object from a file in data folder and importing the object in the components I need that data to use.
But the problem is this method is working just fine in the development server , but when I am building the app as a Static site using 'next build', I am
getting no data from the object. even the file is not present in the production build.

I have tried to move the data folder in the public folder of next.js. With that the files are exporting in the production build, but the issue of getting the data is not solving. I am still not getting any data in the components.

0 Replies