File tree 7 files changed +24
-1
lines changed
7 files changed +24
-1
lines changed Original file line number Diff line number Diff line change
1
+ export interface Foo { }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " dep-import-type" ,
3
+ "version" : " 0.0.0" ,
4
+ "main" : " index.js"
5
+ }
Original file line number Diff line number Diff line change 20
20
"@vitejs/plugin-vue-jsx" : " ^1.1.2" ,
21
21
"@vue/compiler-sfc" : " ^3.0.8" ,
22
22
"@vue/server-renderer" : " ^3.0.6" ,
23
+ "dep-import-type" : " link:./dep-import-type" ,
23
24
"compression" : " ^1.7.4" ,
24
25
"cross-env" : " ^7.0.3" ,
25
26
"express" : " ^4.17.1" ,
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <p >import type should be removed without side-effect</p >
3
+ </template >
4
+
5
+ <script setup lang="ts">
6
+ import type { Foo } from ' dep-import-type/deep'
7
+
8
+ const msg: Foo = {}
9
+ </script >
Original file line number Diff line number Diff line change 6
6
<button @click =" state.count++" >count is: {{ state.count }}</button >
7
7
<Foo />
8
8
<p class =" virtual" >msg from virtual module: {{ foo.msg }}</p >
9
+
10
+ <ImportType />
9
11
</template >
10
12
11
13
<script setup>
12
14
import foo from ' @foo'
13
15
import { reactive , defineAsyncComponent } from ' vue'
16
+ import ImportType from ' ../components/ImportType.vue'
14
17
const Foo = defineAsyncComponent (() =>
15
18
import (' ../components/Foo' ).then ((mod ) => mod .Foo )
16
19
)
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const htmlTypesRE = /\.(html|vue|svelte)$/
38
38
// use Acorn because it's slow. Luckily this doesn't have to be bullet proof
39
39
// since even missed imports can be caught at runtime, and false positives will
40
40
// simply be ignored.
41
- const importsRE = / \b i m p o r t (?: [ \w * { } \n \r \t , ] + f r o m \s * ) ? \s * ( " [ ^ " ] + " | ' [ ^ ' ] + ' ) / gm
41
+ const importsRE = / \b i m p o r t (? ! \s + t y p e ) (? :[ \w * { } \n \r \t , ] + f r o m \s * ) ? \s * ( " [ ^ " ] + " | ' [ ^ ' ] + ' ) / gm
42
42
43
43
export async function scanImports (
44
44
config : ResolvedConfig
Original file line number Diff line number Diff line change @@ -2652,6 +2652,10 @@ delegate@^3.1.2:
2652
2652
version "0.0.0"
2653
2653
uid ""
2654
2654
2655
+ " dep-import-type@link:./packages/playground/ssr-vue/dep-import-type " :
2656
+ version "0.0.0"
2657
+ uid ""
2658
+
2655
2659
" dep-linked-include@link:./packages/playground/optimize-deps/dep-linked-include " :
2656
2660
version "0.0.0"
2657
2661
uid ""
You can’t perform that action at this time.
0 commit comments