Skip to content

Commit

Permalink
chore!: minimum supported Node.js version is 18.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Jan 15, 2024
1 parent 542c9e4 commit 627f55d
Show file tree
Hide file tree
Showing 19 changed files with 9,125 additions and 20,089 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/nodejs.yml
Expand Up @@ -60,7 +60,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [14.x, 16.x, 18.x, 20.x]
# TODO add 21.x after node-sass gets support
node-version: [18.x, 20.x]
webpack-version: [latest]

runs-on: ${{ matrix.os }}

This comment has been minimized.

Copy link
@yoelfc

yoelfc Apr 19, 2024

danyy

Expand All @@ -82,10 +83,6 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install deps

This comment has been minimized.

Copy link
@yoelfc

yoelfc Apr 19, 2024

dajabon

run: npm install node-sass@9.0.0
if: matrix.node-version == '20.x'

- name: Install dependencies
run: npm ci

Expand Down
81 changes: 1 addition & 80 deletions README.md
Expand Up @@ -249,85 +249,6 @@ module.exports = {
};
```

Note that when using `sass` (`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.

We automatically inject the [`fibers`](https://github.com/laverdet/node-fibers) package (setup `sassOptions.fiber`) for `Node.js` less v16.0.0 if is possible (i.e. you need install the [`fibers`](https://github.com/laverdet/node-fibers) package).

> **Warning**
>
> Fibers is not compatible with `Node.js` v16.0.0 or later. Unfortunately, v8 commit [dacc2fee0f](https://github.com/v8/v8/commit/dacc2fee0f815823782a7e432c79c2a7767a4765) is a breaking change and workarounds are non-trivial. ([see introduction to readme](https://github.com/laverdet/node-fibers)).
**package.json**

```json
{
"devDependencies": {
"sass-loader": "^7.2.0",
"sass": "^1.22.10",
"fibers": "^4.0.1"
}
}
```

You can disable automatically injecting the [`fibers`](https://github.com/laverdet/node-fibers) package by passing a `false` value for the `sassOptions.fiber` option.

**webpack.config.js**

```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
fiber: false,
},
},
},
],
},
],
},
};
```

You can also pass the `fiber` value using this code:

**webpack.config.js**

```js
module.exports = {
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
fiber: require("fibers"),
},
},
},
],
},
],
},
};
```

### `sassOptions`

Type:
Expand All @@ -338,7 +259,7 @@ type sassOptions =
| ((
content: string | Buffer,
loaderContext: LoaderContext,
meta: any
meta: any,
) => import("sass").LegacyOptions<"async">);
```

Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Expand Up @@ -10,7 +10,7 @@ module.exports = (api) => {
"@babel/preset-env",
{
targets: {
node: "14.15.0",
node: "18.12.0",

This comment has been minimized.

Copy link
@sag1v

sag1v Apr 14, 2024

@snitin315 Hi :)
May i ask why did you chose to target v18.12.0 instead of lets say v18.0.0?
If you target 18.0.0 wouldn't it be better for consumers (more flexible) or am i missing something?

I'm curious because we have a library which we want to target v18.0.0 and wanted to make sure we don't miss anything that can hurt our consumers.

This comment has been minimized.

Copy link
@snitin315

snitin315 Apr 14, 2024

Author Member

18.12.0 was the v18 LTS at that time.

},
},
],
Expand Down

0 comments on commit 627f55d

Please sign in to comment.