From 7fcc3b080afedc395185b93fa319f3f0aee14398 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Fri, 21 Feb 2025 20:02:21 +0800 Subject: [PATCH 1/4] fix: compatible with vue-loader experimentalInlineMatchResource --- README.md | 4 ++-- src/core/unplugin.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0928c180..0beaa91e 100644 --- a/README.md +++ b/README.md @@ -341,7 +341,7 @@ export default { // `customLoaderMatcher` is depreacted, use `include` instead - customLoaderMatcher: id => id.endsWith('.md'), -+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/], ++ include: [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/, /\.md$/], }), ], } @@ -401,7 +401,7 @@ Components({ // Filters for transforming targets (components to insert the auto import) // Note these are NOT about including/excluding components registered - use `globs` or `excludeNames` for that - include: [/\.vue$/, /\.vue\?vue/], + include: [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/], exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], // Filters for component names that will not be imported diff --git a/src/core/unplugin.ts b/src/core/unplugin.ts index 5f07ad43..a78d3f0b 100644 --- a/src/core/unplugin.ts +++ b/src/core/unplugin.ts @@ -13,7 +13,7 @@ const PLUGIN_NAME = 'unplugin:webpack' export default createUnplugin((options = {}) => { const filter = createFilter( - options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/], + options.include || [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/, /\.vue\?v=/], options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], ) const ctx: Context = new Context(options) From 0efa06ed661ee290fd2521f5308928ce2c36b247 Mon Sep 17 00:00:00 2001 From: Gengkun Date: Sat, 22 Feb 2025 14:40:28 +0800 Subject: [PATCH 2/4] Update unplugin.ts Co-authored-by: neverland --- src/core/unplugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/unplugin.ts b/src/core/unplugin.ts index a78d3f0b..6000bc12 100644 --- a/src/core/unplugin.ts +++ b/src/core/unplugin.ts @@ -13,7 +13,7 @@ const PLUGIN_NAME = 'unplugin:webpack' export default createUnplugin((options = {}) => { const filter = createFilter( - options.include || [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/, /\.vue\?v=/], + options.include || [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/, /\.vue\?v=/], options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], ) const ctx: Context = new Context(options) From a859c310164f491ef56e79fb4f06e3254573d427 Mon Sep 17 00:00:00 2001 From: Gengkun Date: Sat, 22 Feb 2025 15:05:05 +0800 Subject: [PATCH 3/4] Apply suggestions from code review --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0beaa91e..7a18ac45 100644 --- a/README.md +++ b/README.md @@ -341,7 +341,7 @@ export default { // `customLoaderMatcher` is depreacted, use `include` instead - customLoaderMatcher: id => id.endsWith('.md'), -+ include: [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/, /\.md$/], ++ include: [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/, /\.md$/], }), ], } @@ -401,7 +401,7 @@ Components({ // Filters for transforming targets (components to insert the auto import) // Note these are NOT about including/excluding components registered - use `globs` or `excludeNames` for that - include: [/\.vue$/, /\.vue(\.[t|j]sx?)?\?vue/], + include: [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/], exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], // Filters for component names that will not be imported From b31bf8b90ba11d78f5a0b946bed4b1639d028075 Mon Sep 17 00:00:00 2001 From: ahabhgk Date: Mon, 24 Feb 2025 16:13:32 +0800 Subject: [PATCH 4/4] fix --- README.md | 4 ++-- src/core/unplugin.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7a18ac45..cdf4dfe4 100644 --- a/README.md +++ b/README.md @@ -341,7 +341,7 @@ export default { // `customLoaderMatcher` is depreacted, use `include` instead - customLoaderMatcher: id => id.endsWith('.md'), -+ include: [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/, /\.md$/], ++ include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/, /\.md$/], }), ], } @@ -401,7 +401,7 @@ Components({ // Filters for transforming targets (components to insert the auto import) // Note these are NOT about including/excluding components registered - use `globs` or `excludeNames` for that - include: [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/], + include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/], exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], // Filters for component names that will not be imported diff --git a/src/core/unplugin.ts b/src/core/unplugin.ts index 6000bc12..e5cb119a 100644 --- a/src/core/unplugin.ts +++ b/src/core/unplugin.ts @@ -13,7 +13,12 @@ const PLUGIN_NAME = 'unplugin:webpack' export default createUnplugin((options = {}) => { const filter = createFilter( - options.include || [/\.vue$/, /\.vue(\.[tj]sx?)?\?vue/, /\.vue\?v=/], + options.include || [ + /\.vue$/, + /\.vue\?vue/, + /\.vue\.[tj]sx?\?vue/, // for vue-loader with experimentalInlineMatchResource enabled + /\.vue\?v=/, + ], options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/], ) const ctx: Context = new Context(options)