mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 10:54:49 +00:00
17 lines
352 B
TypeScript
17 lines
352 B
TypeScript
|
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))
|
||
|
}
|