next.js/packages/next/src/server/route-matcher-providers/helpers/manifest-loaders/node-manifest-loader.ts
node-manifest-loader.ts22 lines566 B
import { SERVER_DIRECTORY } from '../../../../shared/lib/constants'
import path from '../../../../shared/lib/isomorphic/path'
import type { Manifest, ManifestLoader } from './manifest-loader'

export class NodeManifestLoader implements ManifestLoader {
  constructor(private readonly distDir: string) {}

  static require(id: string) {
    try {
      return require(id)
    } catch {
      return null
    }
  }

  public load(name: string): Manifest | null {
    return NodeManifestLoader.require(
      path.join(this.distDir, SERVER_DIRECTORY, name)
    )
  }
}
Quest for Codev2.0.0
/
SIGN IN