Skip to content

Commit 09964a0

Browse files
authored
feat: make fibers opt-in for dart sass (#3628)
fixes #3429 fixes #3570 fixes #3624
1 parent 9e317d2 commit 09964a0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

docs/guide/css.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can select pre-processors (Sass/Less/Stylus) when creating the project. If y
1212

1313
``` bash
1414
# Sass
15-
npm install -D sass-loader node-sass
15+
npm install -D sass-loader sass
1616

1717
# Less
1818
npm install -D less-loader less
@@ -29,6 +29,14 @@ $color: red;
2929
</style>
3030
```
3131

32+
::: tip A Tip on Sass Performance
33+
Note that when using Dart Sass, **synchronous compilation is twice as fast as asynchronous compilation** by default, due to the overhead of asynchronous callbacks. To avoid this overhead, you can use the [fibers](https://www.npmjs.com/package/fibers) package to call asynchronous importers from the synchronous code path. To enable this, simply install `fibers` as a project dependency:
34+
```
35+
npm install -D fibers
36+
```
37+
Please also be aware, as it's a native module, there may be compatibility issues vary on the OS and build environment. In that case, please run `npm uninstall -D fibers` to fix the problem.
38+
:::
39+
3240
### Automatic imports
3341

3442
If you want to automatically import files (for colors, variables, mixins...), you can use the [style-resources-loader](https://github.com/yenshih/style-resources-loader). Here is an example for stylus that imports `./src/styles/imports.styl` in every SFC and every stylus files:

packages/@vue/cli-service/__tests__/generator.spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ test('dart sass', async () => {
4343

4444
expect(files['src/App.vue']).toMatch('<style lang="scss">')
4545
expect(pkg).toHaveProperty(['devDependencies', 'sass'])
46-
expect(pkg).toHaveProperty(['devDependencies', 'fibers'])
4746
})

packages/@vue/cli-service/generator/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ module.exports = (api, options) => {
4646
'sass-loader': '^7.1.0'
4747
},
4848
'dart-sass': {
49-
fibers: '^3.1.1',
5049
sass: '^1.17.2',
5150
'sass-loader': '^7.1.0'
5251
},

0 commit comments

Comments
 (0)