`env` section in next.config.js is ignored completely.
Unanswered
American Sable posted this in #help-forum
American SableOP
const nextConfig = {
output: "export",
distDir: outputPath,
trailingSlash: true,
generateEtags: true,
transpilePackages: ["next-image-export-optimizer"],
images: {
loader: "custom",
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
},
env: {
// https://github.com/Niels-IO/next-image-export-optimizer
nextImageExportOptimizer_quality: "75",
nextImageExportOptimizer_storePicturesInWEBP: "true",
nextImageExportOptimizer_generateAndUseBlurImages: "true",
// Any images found in /public/original will be optimized
// and copied to /public/optimized-images
nextImageExportOptimizer_imageFolderPath: "public/original",
nextImageExportOptimizer_exportFolderName: "optimized-images",
nextImageExportOptimizer_exportFolderPath: outputPath,
},
};
console.log(process.env);This does not include any of the variables defined above.
but adding them to .env works.
2 Replies
American SableOP
I had 2 temrinals side by side.
on 1 the build was failing, on the other passing.
on the failing terminal did
cd ..
cd my-project
now build does not fail.
but env does from the config does not take effect
on 1 the build was failing, on the other passing.
env bash command was outputting the same on both.on the failing terminal did
cd ..
cd my-project
now build does not fail.
but env does from the config does not take effect
American SableOP
ignore for now, seems to be a by-product from https://nextjs-forum.com/post/1199290023456014427