Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying Dart Sass implementation #9629

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docusaurus/docs/adding-a-sass-stylesheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ If you set `SASS_PATH=node_modules:src`, this will allow you to do imports like
> module.file_ext=.sass
> module.file_ext=.scss
> ```

## Using Dart SASS

`sass-loader` has its own heuristics to figure out if it should use Dart Sass or Node Sass depending on which one is installed. In the particular edge case where both are installed, and you cannot uninstall one of them, you can use `USE_DART_SASS=true` environment variable to force Dart Sass use.

```
USE_DART_SASS=true yarn start
```
3 changes: 3 additions & 0 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== 'false';

const isExtendingEslintConfig = process.env.EXTEND_ESLINT === 'true';

const shouldUseDartSass = process.env.USE_DART_SASS === 'true';

const imageInlineSizeLimit = parseInt(
process.env.IMAGE_INLINE_SIZE_LIMIT || '10000'
);
Expand Down Expand Up @@ -143,6 +145,7 @@ module.exports = function (webpackEnv) {
loader: require.resolve(preProcessor),
options: {
sourceMap: true,
...(shouldUseDartSass ? { implementation: require('sass') } : {}),
},
}
);
Expand Down