Nuxt/packages/cli/src/utils/cjs.ts

17 lines
352 B
TypeScript
Raw Normal View History

2021-04-15 19:17:44 +00:00
export function resolveModule (id, paths?) {
return require.resolve(id, {
paths: [].concat(
// @ts-ignore
global.__NUXT_PREPATHS__,
paths,
process.cwd(),
// @ts-ignore
global.__NUXT_PATHS__
).filter(Boolean)
})
}
export function requireModule (id, paths?) {
return require(resolveModule(id, paths))
}