mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(kit,vite,webpack): strip node_modules/
from parent urls
This commit is contained in:
parent
c1be4f5393
commit
5bd42c893e
@ -90,7 +90,7 @@ export async function loadNuxtModuleInstance (nuxtModule: string | NuxtModule, n
|
|||||||
for (const parentURL of nuxt.options.modulesDir) {
|
for (const parentURL of nuxt.options.modulesDir) {
|
||||||
for (const path of paths) {
|
for (const path of paths) {
|
||||||
try {
|
try {
|
||||||
const src = jiti.esmResolve(path, { parentURL })
|
const src = jiti.esmResolve(path, { parentURL: parentURL.replace(/\/node_modules\/?$/, '') })
|
||||||
nuxtModule = await jiti.import(src) as NuxtModule
|
nuxtModule = await jiti.import(src) as NuxtModule
|
||||||
|
|
||||||
// nuxt-module-builder generates a module.json with metadata including the version
|
// 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
|
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
|
||||||
for (const parentURL of nuxt.options.modulesDir) {
|
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') {
|
if (typeof pluginFn === 'function') {
|
||||||
css.postcss.plugins.push(pluginFn(pluginOptions))
|
css.postcss.plugins.push(pluginFn(pluginOptions))
|
||||||
break
|
break
|
||||||
|
@ -51,7 +51,7 @@ export async function getPostcssConfig (nuxt: Nuxt) {
|
|||||||
|
|
||||||
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
|
let pluginFn: ((opts: Record<string, any>) => Plugin) | undefined
|
||||||
for (const parentURL of nuxt.options.modulesDir) {
|
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') {
|
if (typeof pluginFn === 'function') {
|
||||||
plugins.push(pluginFn(pluginOptions))
|
plugins.push(pluginFn(pluginOptions))
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user