Skip to content

Commit

Permalink
Add example, explain why multiple resolutions
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Sep 26, 2023
1 parent b90318c commit b5310dd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions source/blog/039-rfc-package-importer.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ would allow a package consumer to write:
@use "pkg:library/utils";
```

The Node Package Importer also supports several other ways of defining entry
points, which it resolves in the following order:
We wanted to allow Sass package consumers to start using `pkg:` URLs without
requiring changes from the package authors. Because many Sass packages already
define their entrypoints in a variety of ways, the Node Package Importer also
supports several other ways of defining entrypoints, which cover the majority of
implementations we observed. These resolve in the following order:

1. `sass`, `style`, or `default` condition in package.json `exports` that
resolves to a Sass or CSS file.
Expand Down Expand Up @@ -108,6 +111,14 @@ Users will need to opt-in to the new Package Importer by importing the
`nodePackageImporter` from `sass` and including it in the list of `importers`.
This won't be available for Sass in the browser.

```js
const sass = require('sass');

sass.compile('style.scss', {
importers: [sass.nodePackageImporter]
})
```

## Next steps

This is still in the proposal phase, so we are open to feedback. Review the
Expand Down

0 comments on commit b5310dd

Please sign in to comment.