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._internal.runtimeDir,
...(nitroContext._nuxt.dev ? [] : [nitroContext._nuxt.buildDir]), ...(nitroContext._nuxt.dev ? [] : [nitroContext._nuxt.buildDir]),
...nitroContext.middleware.map(m => m.handle), ...nitroContext.middleware.map(m => m.handle),
nitroContext._nuxt.rootDir,
nitroContext._nuxt.serverDir nitroContext._nuxt.serverDir
], ],
traceOptions: { traceOptions: {

View File

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