mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
fix(kit,vite,webpack): strip node_modules/
from parent urls
This commit is contained in:
parent
73accb5ac1
commit
d3fdbcaac6
@ -84,7 +84,7 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
|
||||
for (const parentURL of nuxt.options.modulesDir) {
|
||||
for (const path of paths) {
|
||||
try {
|
||||
const src = jiti.esmResolve(path, { parentURL })
|
||||
const src = jiti.esmResolve(path, { parentURL: parentURL.replace(/\/node_modules\/?$/, '') })
|
||||
nuxtModule = await jiti.import(src) as NuxtModule
|
||||
|
||||
// nuxt-module-builder generates a module.json with metadata including the version
|
||||
|
@ -29,7 +29,7 @@ export async function resolveCSSOptions (nuxt: Nuxt): Promise<ViteConfig['css']>
|
||||
|
||||
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
|
||||
for (const parentURL of nuxt.options.modulesDir) {
|
||||
pluginFn = await jiti.import(pluginName, { parentURL, try: true }) as (opts: Record<string, any>) => Plugin
|
||||
pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true }) as (opts: Record<string, any>) => Plugin
|
||||
if (typeof pluginFn === 'function') {
|
||||
css.postcss.plugins.push(pluginFn(pluginOptions))
|
||||
break
|
||||
|
@ -51,7 +51,7 @@ export async function getPostcssConfig (nuxt: Nuxt) {
|
||||
|
||||
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
|
||||
for (const parentURL of nuxt.options.modulesDir) {
|
||||
pluginFn = await jiti.import(pluginName, { parentURL, try: true }) as (opts: Record<string, any>) => Plugin
|
||||
pluginFn = await jiti.import(pluginName, { parentURL: parentURL.replace(/\/node_modules\/?$/, ''), try: true }) as (opts: Record<string, any>) => Plugin
|
||||
if (typeof pluginFn === 'function') {
|
||||
plugins.push(pluginFn(pluginOptions))
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user