Skip to content

Commit 2f689ee

Browse files
ahabhgkchenjiahan
andauthored
fix: compatible with vue-loader experimentalInlineMatchResource (#829)
* fix: compatible with vue-loader experimentalInlineMatchResource * Update unplugin.ts Co-authored-by: neverland <jait.chen@foxmail.com> * Apply suggestions from code review * fix --------- Co-authored-by: neverland <jait.chen@foxmail.com>
1 parent b5e2b76 commit 2f689ee

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ export default {
341341

342342
// `customLoaderMatcher` is depreacted, use `include` instead
343343
- customLoaderMatcher: id => id.endsWith('.md'),
344-
+ include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
344+
+ include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/, /\.md$/],
345345
}),
346346
],
347347
}
@@ -401,7 +401,7 @@ Components({
401401

402402
// Filters for transforming targets (components to insert the auto import)
403403
// Note these are NOT about including/excluding components registered - use `globs` or `excludeNames` for that
404-
include: [/\.vue$/, /\.vue\?vue/],
404+
include: [/\.vue$/, /\.vue\?vue/, /\.vue\.[tj]sx?\?vue/],
405405
exclude: [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
406406

407407
// Filters for component names that will not be imported

src/core/unplugin.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const PLUGIN_NAME = 'unplugin:webpack'
1313

1414
export default createUnplugin<Options>((options = {}) => {
1515
const filter = createFilter(
16-
options.include || [/\.vue$/, /\.vue\?vue/, /\.vue\?v=/],
16+
options.include || [
17+
/\.vue$/,
18+
/\.vue\?vue/,
19+
/\.vue\.[tj]sx?\?vue/, // for vue-loader with experimentalInlineMatchResource enabled
20+
/\.vue\?v=/,
21+
],
1722
options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/, /[\\/]\.nuxt[\\/]/],
1823
)
1924
const ctx: Context = new Context(options)

0 commit comments

Comments
 (0)