mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxt): fall back to plugin.src
for variable name generation (#30649)
This commit is contained in:
parent
632e7f941f
commit
929dcfbed5
@ -68,7 +68,7 @@ export const clientPluginTemplate: NuxtTemplate = {
|
|||||||
const imports: string[] = []
|
const imports: string[] = []
|
||||||
for (const plugin of clientPlugins) {
|
for (const plugin of clientPlugins) {
|
||||||
const path = relative(ctx.nuxt.options.rootDir, plugin.src)
|
const path = relative(ctx.nuxt.options.rootDir, plugin.src)
|
||||||
const variable = genSafeVariableName(filename(plugin.src)).replace(PLUGIN_TEMPLATE_RE, '_') + '_' + hash(path)
|
const variable = genSafeVariableName(filename(plugin.src) || path).replace(PLUGIN_TEMPLATE_RE, '_') + '_' + hash(path)
|
||||||
exports.push(variable)
|
exports.push(variable)
|
||||||
imports.push(genImport(plugin.src, variable))
|
imports.push(genImport(plugin.src, variable))
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ export const serverPluginTemplate: NuxtTemplate = {
|
|||||||
const imports: string[] = []
|
const imports: string[] = []
|
||||||
for (const plugin of serverPlugins) {
|
for (const plugin of serverPlugins) {
|
||||||
const path = relative(ctx.nuxt.options.rootDir, plugin.src)
|
const path = relative(ctx.nuxt.options.rootDir, plugin.src)
|
||||||
const variable = genSafeVariableName(filename(path)).replace(PLUGIN_TEMPLATE_RE, '_') + '_' + hash(path)
|
const variable = genSafeVariableName(filename(plugin.src) || path).replace(PLUGIN_TEMPLATE_RE, '_') + '_' + hash(path)
|
||||||
exports.push(variable)
|
exports.push(variable)
|
||||||
imports.push(genImport(plugin.src, variable))
|
imports.push(genImport(plugin.src, variable))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user