WFDASHDRIVER-APP/next.config.js

26 lines
803 B
JavaScript
Raw Permalink Normal View History

const fs = require('fs');
const path = require('path');
// One id per build, shared with the build workers through process.env (they
// inherit it), and written to public/version.json so a running app can ask
// the server which build is live (components/UpdateWatcher).
if (!process.env.NEXT_PUBLIC_BUILD_ID) {
process.env.NEXT_PUBLIC_BUILD_ID = Date.now().toString(36);
fs.writeFileSync(
path.join(__dirname, 'public', 'version.json'),
JSON.stringify({ id: process.env.NEXT_PUBLIC_BUILD_ID }) + '\n',
);
}
/** @type {import('next').NextConfig} */
const nextConfig = {
// Only use static export for production builds
...(process.env.NEXT_EXPORT === 'true' ? { output: 'export' } : {}),
images: {
unoptimized: true,
},
trailingSlash: true,
};
module.exports = nextConfig;