diff --git a/packages/nitro/src/rollup/plugins/automock.ts b/packages/nitro/src/rollup/plugins/automock.ts index ffc34d2d17..79de6c39dd 100644 --- a/packages/nitro/src/rollup/plugins/automock.ts +++ b/packages/nitro/src/rollup/plugins/automock.ts @@ -1,10 +1,12 @@ import consola from 'consola' +const internalRegex = /^\.|\?|\.[mc]?js$|.ts$/ + export function autoMock () { return { name: 'auto-mock', resolveId (src: string) { - if (src && !src.startsWith('.') && !src.includes('?') && !src.includes('.js')) { + if (src && !internalRegex.test(src)) { consola.warn('Auto mock external ', src) return { id: require.resolve('unenv/runtime/mock/proxy')