mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
fix(automock): don't externalize .ts imports
This commit is contained in:
parent
82b585dbb0
commit
d95e002d5b
@ -1,10 +1,12 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
|
const internalRegex = /^\.|\?|\.[mc]?js$|.ts$/
|
||||||
|
|
||||||
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 && !internalRegex.test(src)) {
|
||||||
consola.warn('Auto mock external ', src)
|
consola.warn('Auto mock external ', src)
|
||||||
return {
|
return {
|
||||||
id: require.resolve('unenv/runtime/mock/proxy')
|
id: require.resolve('unenv/runtime/mock/proxy')
|
||||||
|
Loading…
Reference in New Issue
Block a user