File tree 1 file changed +5
-4
lines changed
packages/vite/src/node/plugins
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -156,13 +156,14 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {
156
156
const resolveSubpathImports = ( id : string , importer ?: string ) => {
157
157
if ( ! importer || ! id . startsWith ( subpathImportsPrefix ) ) return
158
158
const basedir = path . dirname ( importer )
159
- const importerPkgJson = lookupFile ( basedir , [ 'package.json' ] , {
160
- predicate : ( content ) => ! ! JSON . parse ( content ) . name ,
159
+ const pkgJsonPath = lookupFile ( basedir , [ 'package.json' ] , {
160
+ pathOnly : true ,
161
161
} )
162
- if ( ! importerPkgJson ) return
162
+ if ( ! pkgJsonPath ) return
163
163
164
+ const pkgData = loadPackageData ( pkgJsonPath , options . preserveSymlinks )
164
165
return resolveExportsOrImports (
165
- JSON . parse ( importerPkgJson ) ,
166
+ pkgData . data ,
166
167
id ,
167
168
options ,
168
169
targetWeb ,
You can’t perform that action at this time.
0 commit comments