Support for SASS nodeJS package importer #16438
Labels
enhancement
New feature or request
feat: css
p2-nice-to-have
Not breaking anything but nice to have (priority)
Describe the bug
I am making a generic app that that offers both a SASS and a CSS stylesheet to users, so they can use whichever suits their needs. However, there is an issue with the import of node packages.
SASS now has the --pkg-importer=node option that allows it to load dependencies using the Node.js module resolution algorithm. Using this CLI option i can import a path that is defined on the
package.json
"export".However, the above does not work in the context of a node app. With that, i mean that if we try to import the
.scss
containing the above code in amain.js
file, we'll get:I checked the documentation but couldn't find a way to configure this or add the SASS importer as seen on the sass example.
I would expect that we can use the supported
pkg:
prefix to both build the SASS/SCSS file to css and serve a node app using that same code, or at least be able to configure the css options to enable that support.Note: I understand that bootstrap does not have an "exports" property in their package.json. I used it for a simple example, the behavior is the same with packages that define "export".
Reproduction
https://github.com/kkesidis/vite-sass-pkg-prefix
Steps to reproduce
yarn build:scss
to build the css file. This will succed.System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: