You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there.
I'm the author of a Custom Importer for sass which enables Node Module Resolution as well as path mapping.
I've been looking into migrating to the new Custom Importer API, but it seems this won't actually be possible.
Previously, a Custom Importer would be invoked with the raw, unaltered module specifier ("URL", as you call it inside your documentation) as the first argument, followed by the URL of the importing file ("prev", as you call it).
For example, when parsing @import "my-alias" from the file /foo/bar/baz.scss, a Custom Importer would be invoked with "my alias" as the first argument, and "/foo/bar/baz.scss", as the second argument.
Having access to the exact value provided to the import statement here is essential to the path mapping feature I'm currently supporting via the legacy API. For example, as documented here, consider a scenario in which "my-alias" is actually path mapped to another location on the filesystem, configured like so:
With the new Custom Importer API, the canonicalize method is invoked with a full URL (prefixed by a protocol like file://), and no way of knowing exactly what was actually written. In the original example from above, that URL would like like this: file://foo/bar/my-alias, making it impossible to understand how to map that to the path mapped values.
To work around this, and to allow me to migrate to the new API, I request having access to the raw, unaltered URL/module specifier as part of the options object that canonicalize is invoked with as the second argument, and ideally also the URL of the file importing it, if any ("prev").
I'm also open to suggestions as to how I might be able to achieve this with the current API, as I currently don't see a way forward.
Thanks for your time.
The text was updated successfully, but these errors were encountered:
Hi there.
I'm the author of a Custom Importer for sass which enables Node Module Resolution as well as path mapping.
I've been looking into migrating to the new Custom Importer API, but it seems this won't actually be possible.
Previously, a Custom Importer would be invoked with the raw, unaltered module specifier ("URL", as you call it inside your documentation) as the first argument, followed by the URL of the importing file ("prev", as you call it).
For example, when parsing
@import "my-alias"
from the file/foo/bar/baz.scss
, a Custom Importer would be invoked with"my alias"
as the first argument, and"/foo/bar/baz.scss"
, as the second argument.Having access to the exact value provided to the import statement here is essential to the path mapping feature I'm currently supporting via the legacy API. For example, as documented here, consider a scenario in which
"my-alias"
is actually path mapped to another location on the filesystem, configured like so:With the new Custom Importer API, the
canonicalize
method is invoked with a full URL (prefixed by a protocol likefile://
), and no way of knowing exactly what was actually written. In the original example from above, that URL would like like this:file://foo/bar/my-alias
, making it impossible to understand how to map that to the path mapped values.To work around this, and to allow me to migrate to the new API, I request having access to the raw, unaltered URL/module specifier as part of the options object that
canonicalize
is invoked with as the second argument, and ideally also the URL of the file importing it, if any ("prev").I'm also open to suggestions as to how I might be able to achieve this with the current API, as I currently don't see a way forward.
Thanks for your time.
The text was updated successfully, but these errors were encountered: