Next.js Discord

Discord Forum

Fetching data on build

Unanswered
Capelin posted this in #help-forum
Open in Discord
CapelinOP
Heya.

I am currently using next-intl and Crowdin.
I want to fetch the Crowdin API to see which languages haven't been translated and hide them from the menu

My problem is, I don't want any information like env variables visible on the client
I only want to fetch it on build, and not on server start (I can check the phase for this)
But to save the data from the API during build, I need to write it to a file and read it during prod server
But I get an error saying that I can't import fs.

./next.config.mjs
Module not found: Can't resolve 'fs'

I was wondering if this is still possible

1 Reply

CapelinOP
please be as kind to mention me on response