silverwolf-x's picture
download
raw
570 Bytes
import type { ModuleLoader } from './module-loader'
/**
* Loads a module using `await require(id)`.
*/
export class NodeModuleLoader implements ModuleLoader {
public async load<M>(id: string): Promise<M> {
if (process.env.NEXT_RUNTIME !== 'edge') {
// Need to `await` to cover the case that route is marked ESM modules by ESM escalation.
return await (process.env.NEXT_MINIMAL
? // @ts-ignore
__non_webpack_require__(id)
: require(id))
}
throw new Error('NodeModuleLoader is not supported in edge runtime.')
}
}

Xet Storage Details

Size:
570 Bytes
·
Xet hash:
9b9eebbacc88416ee9274aa4c53f85a4d0002e46828519cf605ad270820e4265

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.