Open NetherGranite opened 1 year ago
I don't know all the edge cases or how exactly missingDependencies
is populated (search results), but maybe a simple fix is ensuring missing dependencies end in the same file type as the glob import?
For example, this works for me:
// Determine the file type being resolved.
const fileTypeToResolve = pathToResolve.substring(pathToResolve.lastIndexOf('/') + 1);
// Filter down to missing dependencies with file types matching the file type being resolved.
missing = missing.filter((missingDependency) => { return missingDependency.endsWith(fileTypeToResolve); });
Or maybe there's an appropriate setting in EnhancedResolver.
Given
import '*.js'
, EnhancedResolver produces the followingmissingDependencies
in theresolveContext
:Even worse, given
import '**/*.js'
, EnhancedResolver produces the followingmissingDependencies
in theresolveContext
:This loader then feeds each of those
missingDependencies
to a glob resolver as seen here. This means that, for example,package.json
will be included in the**/*.js
import.While this is a silent mistake for JS pipelines since it's valid to import JSON, this is a breaking issue in SCSS as things like
@import 'package.json'
are produced.