INNER CODE UNIT · TypeScript

packageRoot

UfoMiao/zcf · src/i18n/index.ts:72

          const packageRoot = (() => {
            let dir = currentDir
            // Look for package.json to identify package root
            while (dir !== dirname(dir)) {
              if (existsSync(join(dir, 'package.json'))) {
                return dir
              }
              dir = dirname(dir)
            }
            return currentDir
          })()

          // Try multiple possible paths in order of preference
          const possibleBasePaths = [
            join(currentDir, 'locales'), // Development: src/i18n/locales
            join(packageRoot, 'dist/i18n/locales'), // NPM package: /node_modules/zcf/dist/i18n/locales
            join(process.cwd(), 'dist/i18n/locales'), // Production build: ./dist/i18n/locales
            join(currentDir, '../../../dist/i18n/locales'), // Fallback for deep chunk paths

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…