Skip to content

Commit

Permalink
fix(automock): don't externalize .ts imports
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed May 20, 2021
1 parent 37e0d88 commit 077bf13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rollup/plugins/automock.ts
Original file line number Diff line number Diff line change
@@ -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')
Expand Down

0 comments on commit 077bf13

Please sign in to comment.