Add asset prefix on export

This commit is contained in:
DefectingCat
2022-09-01 18:00:54 +08:00
parent 92b6e52828
commit e06078646b

View File

@ -18,6 +18,7 @@
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const isExport = process.env.NEXT_BUILD === 'export';
const nextConfig = { const nextConfig = {
/* config options here */ /* config options here */
reactStrictMode: true, reactStrictMode: true,
@ -25,11 +26,11 @@ const nextConfig = {
experimental: { experimental: {
// runtime: 'nodejs', // runtime: 'nodejs',
// outputStandalone: true, // outputStandalone: true,
images: images: isExport
process.env.NEXT_BUILD === 'export'
? { allowFutureImage: true, unoptimized: true } ? { allowFutureImage: true, unoptimized: true }
: { allowFutureImage: true }, : { allowFutureImage: true },
}, },
assetPrefix: isExport ? './' : undefined,
// images: // images:
// process.env.NEXT_BUILD === 'export' // process.env.NEXT_BUILD === 'export'
// ? { // ? {