mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxt3): enable auto-imports for sfc script with type (#931)
This commit is contained in:
parent
ff97e2558c
commit
a42458e107
@ -30,14 +30,17 @@ export const TransformPlugin = createUnplugin((map: IdentifierMap) => {
|
|||||||
enforce: 'post',
|
enforce: 'post',
|
||||||
transformInclude (id) {
|
transformInclude (id) {
|
||||||
const { pathname, search } = parseURL(id)
|
const { pathname, search } = parseURL(id)
|
||||||
const query = parseQuery(search)
|
const { type } = parseQuery(search)
|
||||||
|
|
||||||
if (id.includes('node_modules')) {
|
if (id.includes('node_modules')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// vue files
|
// vue files
|
||||||
if (pathname.endsWith('.vue') && (query.type === 'template' || !search)) {
|
if (
|
||||||
|
pathname.endsWith('.vue') &&
|
||||||
|
(type === 'template' || type === 'script' || !search)
|
||||||
|
) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user