mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): avoid stripping js extensions in plugin injections (#28593)
This commit is contained in:
parent
d9046468d1
commit
4354d31090
@ -110,6 +110,8 @@ declare module '#app/defaults' {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const TS_RE = /\.[cm]?tsx?$/
|
||||||
|
|
||||||
export const pluginsDeclaration: NuxtTemplate = {
|
export const pluginsDeclaration: NuxtTemplate = {
|
||||||
filename: 'types/plugins.d.ts',
|
filename: 'types/plugins.d.ts',
|
||||||
getContents: async ({ nuxt, app }) => {
|
getContents: async ({ nuxt, app }) => {
|
||||||
@ -138,9 +140,14 @@ export const pluginsDeclaration: NuxtTemplate = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (exists(pluginPath)) {
|
if (exists(pluginPath)) {
|
||||||
|
if (TS_RE.test(pluginPath)) {
|
||||||
tsImports.push(relativePath.replace(EXTENSION_RE, ''))
|
tsImports.push(relativePath.replace(EXTENSION_RE, ''))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
tsImports.push(relativePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// No declaration found that TypeScript can use
|
||||||
}
|
}
|
||||||
|
|
||||||
return `// Generated by Nuxt'
|
return `// Generated by Nuxt'
|
||||||
|
Loading…
Reference in New Issue
Block a user