Error on build on CI/CD
If you get an error like this on Next.js:
Copy the code to the clipboard
Here some solutions:
1. Missing dictionaries
Ensure that the dictionaries are built at the stage of the build.
It's frquent that the build works locally but not on CI/CD. The reason is that locally, the .intlayer directory is present, but on CI/CD, it's not as it's excluded from the build.
You can fix it by adding a prebuild script in the package.json of your project.
Copy the code to the clipboard
Not that if you use the withIntlayer function, or the equivalent bundler plugin for your framework, the prebuild script will be run before the build.
2. Missing environment variables at build / run time
In a container, or auto-deployed platform, it's recommended to exclude the .env file from the build.
Copy the code to the clipboard
If your environment variables are not available at build time, an error will be thrown.
Copy the code to the clipboard
It's probably not related to Intlayer. So check your environment variables at build time on your CI/CD platform.