2020-12-22 17:07:50 +00:00
|
|
|
import { requireModule } from '@nuxt/utils'
|
2018-11-15 20:48:47 +00:00
|
|
|
|
2020-12-22 17:07:50 +00:00
|
|
|
export const importModule = (id) => {
|
|
|
|
try {
|
|
|
|
return Promise.resolve(requireModule(id))
|
|
|
|
} catch (err) {
|
|
|
|
if (err.code === 'MODULE_NOT_FOUND') {
|
|
|
|
err.message = `Cannot import module '${id}'`
|
2019-01-12 20:21:43 +00:00
|
|
|
}
|
2020-12-22 17:07:50 +00:00
|
|
|
return Promise.reject(err)
|
2018-11-15 20:48:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-22 17:07:50 +00:00
|
|
|
export const builder = () => importModule('@nuxt/builder')
|
|
|
|
export const webpack = () => importModule('@nuxt/webpack')
|
|
|
|
export const generator = () => importModule('@nuxt/generator')
|
|
|
|
export const core = () => importModule('@nuxt/core')
|
|
|
|
export const server = () => importModule('@nuxt/server')
|