diff --git a/packages/wxt/src/core/resolve-config.ts b/packages/wxt/src/core/resolve-config.ts index 6c2b2c06c..1a1ffe71b 100644 --- a/packages/wxt/src/core/resolve-config.ts +++ b/packages/wxt/src/core/resolve-config.ts @@ -28,7 +28,7 @@ import { getEslintVersion } from './utils/eslint'; import { safeStringToNumber } from './utils/number'; import { loadEnv } from './utils/env'; import { getPort } from 'get-port-please'; -import { fileURLToPath, pathToFileURL } from 'node:url'; +import { fileURLToPath } from 'node:url'; import { createWxtLogger } from './utils/log/wxtLogger'; /** @@ -537,10 +537,10 @@ async function getUnimportEslintOptions( /** Returns the path to `node_modules/wxt`. */ function resolveWxtModuleDir() { - const url = import.meta.resolve('wxt', import.meta.url); + const url = import.meta.resolve('wxt'); - // esmResolve() returns the "wxt/dist/index.mjs" file, not the package's root - // directory, which we want to return from this function. + // import.meta.resolve returns the package entry (e.g. dist/index.mjs), not the + // package root directory, which we want to return from this function. return path.resolve(fileURLToPath(url), '../..'); } @@ -588,12 +588,10 @@ export async function resolveWxtUserModules( modulesDir: string, modules: string[] = [], ): Promise[]> { - const importer = pathToFileURL(path.join(root, 'index.js')).href; - // Resolve node_modules modules const npmModules = await Promise.all>( modules.map(async (moduleId) => { - const resolvedModulePath = import.meta.resolve(moduleId, importer); + const resolvedModulePath = import.meta.resolve(moduleId); const mod: { default: WxtModule } = await import( /* @vite-ignore */ resolvedModulePath );