File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
packages/sandpack-core/src/npm/dynamic Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,8 @@ function resolvePath(
141141 currentTModule : TranspiledModule ,
142142 manager : Manager ,
143143 defaultExtensions : Array < string > = DEFAULT_EXTENSIONS ,
144- meta : Meta = { }
144+ meta : Meta = { } ,
145+ ignoreDepNameVersion : string = ''
145146) : Promise < string > {
146147 const currentPath = currentTModule . module . path ;
147148
@@ -165,7 +166,10 @@ function resolvePath(
165166 const depName = getDependencyName ( depPath ) ;
166167
167168 // To prevent infinite loops we keep track of which dependencies have been requested before.
168- if ( ! manager . transpiledModules [ p ] && ! meta [ p ] ) {
169+ if (
170+ ( ! manager . transpiledModules [ p ] && ! meta [ p ] ) ||
171+ ignoreDepNameVersion === depName
172+ ) {
169173 const err = new Error ( 'Could not find ' + p ) ;
170174 // @ts -ignore
171175 err . code = 'ENOENT' ;
@@ -238,11 +242,14 @@ async function getDependencyVersion(
238242 const { manifest } = manager ;
239243
240244 try {
245+ const filepath = pathUtils . join ( dependencyName , 'package.json' ) ;
241246 const foundPackageJSONPath = await resolvePath (
242- pathUtils . join ( dependencyName , 'package.json' ) ,
247+ filepath ,
243248 currentTModule ,
244249 manager ,
245- [ ]
250+ [ ] ,
251+ { } ,
252+ dependencyName
246253 ) ;
247254
248255 // If the dependency is in the root we get it from the manifest, as the manifest
You can’t perform that action at this time.
0 commit comments