Error on build on CI/CD
If you get an error like this on Next.js:
Copy the code to the clipboard
Here are some solutions:
1. Missing dictionaries
Ensure that the dictionaries are built at the stage of the build.
It's frequent 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 is not as it is excluded from the build.
You can fix this by adding a prebuild script in the package.json of your project.
Copy the code to the clipboard
Note 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 is 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 is probably not related to Intlayer. Therefore, check your environment variables at build time on your CI/CD platform.