Open TeoTN opened 4 years ago
I tried before, just replace node-sass
with sass
the problem with this plugin is that you can't configure explicitely which sass loader you want to use. Since other projects might have node-sass
as a dependency, you're at the mercy of hoping that node-sass isn't installed. Based on this snippet in this projects' code you can see that it's just selecting node-sass
as the preferred sass loader if it's found. So be careful saying that 'it just works', because it will break the moment you install a package that's incompatible with this logic: https://github.com/egoist/rollup-plugin-postcss/blob/92b274431e2433746d39f1e37877dfda7cf1230e/src/sass-loader.js#L22-L29
Yep, this is a serious and pretty dangerous limitation, because it's not clear from the developer's perspective what runtime will be actually used for SASS processing.
I guess the first thing that should be done is switching from using node-sass
to using sass
by default, because sass
(Dart SASS) is a reference implementation, which is probably more preferred. But it's not a final solution of course.
It should be possible not only to select a runtime by it's name, but also by passing a module directly or a full path of the module to the plugin, i.e.: sassRuntime: require('sass')
or sassRuntime: require.resolve('sass')
, because in complex projects the actual runtime implementation could be installed in different path.
Inside a large monorepo, it is quite common that you have both sass and node-sass installed and accessible by any package. Without a config for sass selector, it is not possible for some one to use 'sass' instead of 'node-sass'.
Hey! I was wondering, cause the documentation doesn't mention it, if it's possible to use only dart-sass and not the node-sass? If so, how?