fix(nitro): exclude rootDir from externals and reinstate automock warning (#66)

This commit is contained in:
Daniel Roe 2021-04-09 09:03:49 +01:00 committed by GitHub
parent 3eb3927779
commit 00c7ede623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -195,6 +195,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
nitroContext._internal.runtimeDir,
...(nitroContext._nuxt.dev ? [] : [nitroContext._nuxt.buildDir]),
...nitroContext.middleware.map(m => m.handle),
nitroContext._nuxt.rootDir,
nitroContext._nuxt.serverDir
],
traceOptions: {

View File

@ -1,8 +1,11 @@
import consola from 'consola'
export function autoMock () {
return {
name: 'auto-mock',
resolveId (src: string) {
if (src && !src.startsWith('.') && !src.includes('?') && !src.includes('.js')) {
consola.warn('Auto mock external ', src)
return {
id: require.resolve('@nuxt/un/runtime/mock/proxy')
}