Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions packages/core/src/admin-ui/templates/next-config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
export const nextConfigTemplate = (basePath?: string) =>
`const nextConfig = {
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
// We use transpilePackages for the custom admin-ui pages in the ./admin folder
// as they import ts files into nextjs
transpilePackages: ['../../admin'],
${basePath ? `basePath: '${basePath}',` : ''}
`const fs = require('fs');
const path = require('path');
const { merge } = require('lodash');

// Base configuration for Next.js
const nextConfig = {
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
transpilePackages: ['../../admin'], // custom admin-ui pages
${basePath ? `basePath: '${basePath}',` : ""}
};

// Path to the potential custom config file
const customConfigPath = path.join(__dirname, '..', '..', 'next.config.js');

// Check if the custom config file exists and merge it
try {
if (fs.existsSync(customConfigPath)) {
const customConfig = require(customConfigPath);
merge(nextConfig, customConfig);
}

module.exports = nextConfig`
} catch (error) {
console.error('Failed to load or merge custom config:', error);
}

module.exports = nextConfig;
`;