fix(kit): normalize plugin imports paths (#1779)

This commit is contained in:
Emil Akhadov 2021-11-09 09:44:00 +00:00 committed by GitHub
parent c577e1991e
commit 82d1741d52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { existsSync, promises as fsp } from 'fs'
import { basename, extname, parse, resolve } from 'pathe'
import { basename, extname, normalize, parse, resolve } from 'pathe'
import lodashTemplate from 'lodash.template'
import hash from 'hash-sum'
import { pascalCase, camelCase, kebabCase } from 'scule'
@ -90,6 +90,9 @@ export function normalizePlugin (plugin: NuxtPlugin | string): NuxtPlugin {
throw new Error('Invalid plugin. src option is required: ' + JSON.stringify(plugin))
}
// Normalize full path to plugin
plugin.src = normalize(plugin.src)
// Normalize mode
if (plugin.ssr) {
plugin.mode = 'server'