fix(dashboard): resolve all module import errors and fix CSS loading

## Module Import Fixes:
- Fix cloud_iac JSON import paths: '../../../../public/_build/cloud_iac_index.json' → '../../../../../public/_build/cloud_iac_index.json'
- Fix docs JSON import paths: '../../public/dl-index/*' and '../../public/_build/*' → '../../../public/*'
- Fix ThemePreferenceCard theme import: '../../../../theme' → '../routes/theme'
- Fix products registry import: '@src/products/registry' → '../../../../modules/products/registry'

## CSS Loading Fix:
- Update tailwind.config.js content paths to include './src/**/*.{js,ts,jsx,tsx,mdx}'
- Ensures Tailwind CSS scans all src/ directory files for class names

Resolves "Module not found" errors and ensures CSS styles are correctly loaded during build.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Haitao Pan 2025-11-11 12:04:29 +08:00
parent aa6e0fe1b2
commit ee70e79f76
11 changed files with 17825 additions and 4915 deletions

View File

@ -4,4 +4,4 @@ enableGlobalCache: false
nodeLinker: node-modules
npmRegistryServer: "https://registry.npmjs.org"
npmRegistryServer: "https://registry.npmmirror.com"

View File

@ -1,7 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@ -1,103 +0,0 @@
/**
* 功能控制的树形结构每个节点都可以通过 enabled 控制是否启用
* - children 支持精确路径动态段([param])以及通配符(*)
* - 当某个节点 enabled false 其所有子级都会默认关闭
*/
const path = require('path')
const featureToggles = require('./config/feature-toggles.json')
const normalizeSegments = (pathname = '') =>
pathname
.replace(/^\/+|\/+$/g, '')
.split('/')
.filter(Boolean)
const findDynamicChildKey = (children = {}) =>
Object.keys(children).find((key) => /^\[(\.\.\.)?.+\]$/.test(key))
const resolveToggle = (node, segments) => {
if (!node) return true
const isEnabled = node.enabled !== false
if (!isEnabled) return false
if (!segments.length) return isEnabled
const children = node.children || {}
const [current, ...rest] = segments
const exactChild = children[current]
const dynamicChildKey = findDynamicChildKey(children)
const wildcardChild = children['*']
const nextNode =
exactChild ?? (dynamicChildKey ? children[dynamicChildKey] : undefined) ?? wildcardChild
if (!nextNode) return isEnabled
return resolveToggle(nextNode, rest)
}
const isFeatureEnabled = (section, pathname) => {
const tree = featureToggles[section]
if (!tree) return true
const segments = normalizeSegments(pathname)
return resolveToggle(tree, segments)
}
// Static exports are incompatible with dynamic route handlers used for auth.
// Allow opting-in explicitly to avoid breaking the default production build.
const shouldUseStaticExport = process.env.NEXT_SHOULD_EXPORT === 'true'
/** @type {import('next').NextConfig} */
const nextConfig = {
...(shouldUseStaticExport ? { output: 'export' } : {}),
trailingSlash: false,
reactStrictMode: true,
compress: false, // 压缩交给 Nginx省 Node CPU
poweredByHeader: false,
images: { unoptimized: true }, // 关闭服务端图片处理
httpAgentOptions: {
keepAlive: true,
},
async headers() {
return [
{
source: '/api/:path*',
headers: [
{
key: 'Cache-Control',
value: 'no-store',
},
],
},
]
},
async rewrites() {
return [
{
source: '/api/:path*/',
destination: '/api/:path*',
},
]
},
webpack(config) {
config.module.rules.push({
test: /\.ya?ml$/i,
type: 'asset/source',
})
config.resolve.alias = {
...(config.resolve.alias ?? {}),
'@cms': path.join(__dirname, 'src', 'lib', 'cms'),
'@components': path.join(__dirname, 'src', 'components'),
'@i18n': path.join(__dirname, 'src', 'i18n'),
'@lib': path.join(__dirname, 'src', 'lib'),
'@types': path.join(__dirname, 'types'),
'@server': path.join(__dirname, 'src', 'server'),
'@modules': path.join(__dirname, 'src', 'modules'),
'@extensions': path.join(__dirname, 'src', 'modules', 'extensions'),
'@theme': path.join(__dirname, 'src', 'components', 'theme'),
'@templates': path.join(__dirname, 'src', 'modules', 'templates'),
'@src': path.join(__dirname, 'src'),
}
return config
},
}
module.exports = nextConfig

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ import type { Metadata } from 'next'
import { notFound } from 'next/navigation'
import Client from './Client'
import { PRODUCT_MAP, getAllSlugs } from '@src/products/registry'
import { PRODUCT_MAP, getAllSlugs } from '../../../../modules/products/registry'
type PageProps = {
params: Promise<{

View File

@ -7,7 +7,7 @@ import ServiceDetailView from '@components/iac/ServiceDetailView'
import { CATALOG, PROVIDERS } from '@lib/iac/catalog'
import type { CatalogItem, ProviderKey } from '@lib/iac/types'
import cloudIacIndex from '../../../../public/_build/cloud_iac_index.json'
import cloudIacIndex from '../../../../../public/_build/cloud_iac_index.json'
import { isFeatureEnabled } from '@lib/featureToggles'
type PageParams = {

View File

@ -7,7 +7,7 @@ import CloudIacCatalog from '@components/iac/CloudIacCatalog'
import { CATALOG, PROVIDERS } from '@lib/iac/catalog'
import type { ProviderKey } from '@lib/iac/types'
import cloudIacIndex from '../../../public/_build/cloud_iac_index.json'
import cloudIacIndex from '../../../../../public/_build/cloud_iac_index.json'
import { isFeatureEnabled } from '@lib/featureToggles'
type PageParams = {

View File

@ -1,8 +1,8 @@
import 'server-only'
import { isFeatureEnabled } from '@lib/featureToggles'
import docsManifest from '../../public/dl-index/docs-manifest.json'
import fallbackDocsIndex from '../../public/_build/docs_index.json'
import docsManifest from '../../../public/dl-index/docs-manifest.json'
import fallbackDocsIndex from '../../../public/_build/docs_index.json'
import { buildAbsoluteDocUrl } from './utils'
import type { DocCollection, DocResource, DocVersionOption } from './types'

View File

@ -3,8 +3,8 @@
import { useMemo } from 'react'
import Card from '../components/Card'
import { darkTheme, lightTheme, useTheme } from '../../../../theme'
import type { ThemeDefinition, ThemeName, ThemePreference } from '../../../../theme'
import { darkTheme, lightTheme, useTheme } from '../routes/theme'
import type { ThemeDefinition, ThemeName, ThemePreference } from '../routes/theme'
const THEME_OPTIONS: Array<{
value: ThemePreference

View File

@ -1,7 +1,7 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./app/**/*.{ts,tsx}', './components/**/*.{ts,tsx}'],
content: ['./src/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}'],
theme: {
extend: {
fontFamily: {