Skip to content

Commit c1f7c2b

Browse files
refactor: charset option
1 parent 634e561 commit c1f7c2b

13 files changed

+9335
-6763
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,13 @@ Default: defaults values for Sass implementation
306306

307307
Options for [Dart Sass](http://sass-lang.com/dart-sass) or [Node Sass](https://github.com/sass/node-sass) implementation.
308308

309+
> ℹ️ The `charset` option has `true` value by default for `dart-sass`, we strongly discourage change value to `false`, because webpack doesn't support files other than `utf-8`.
310+
309311
> ℹ️ The `indentedSyntax` option has `true` value for the `sass` extension.
310312
311313
> ℹ️ Options such as `data` and `file` are unavailable and will be ignored.
312314
313-
> ℹ We recommend not to set the `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader` automatically sets these options when the `sourceMap` option is `true`.
315+
> ℹ We strongly discourage change `outFile`, `sourceMapContents`, `sourceMapEmbed`, `sourceMapRoot` options because `sass-loader` automatically sets these options when the `sourceMap` option is `true`.
314316
315317
> ℹ️ Access to the [loader context](https://webpack.js.org/api/loaders/#the-loader-context) inside the custom importer can be done using the `this.webpackLoaderContext` property.
316318

package-lock.json

Lines changed: 2536 additions & 3180 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@
6262
"@babel/cli": "^7.14.5",
6363
"@babel/core": "^7.14.6",
6464
"@babel/preset-env": "^7.14.7",
65-
"@commitlint/cli": "^12.1.4",
66-
"@commitlint/config-conventional": "^12.1.4",
65+
"@commitlint/cli": "^13.1.0",
66+
"@commitlint/config-conventional": "^13.1.0",
6767
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
6868
"babel-jest": "^27.0.6",
6969
"bootstrap-sass": "^3.4.1",
7070
"bootstrap-v4": "npm:bootstrap@^4.5.3",
7171
"bootstrap-v5": "npm:bootstrap@^5.0.1",
7272
"cross-env": "^7.0.3",
73-
"css-loader": "^5.2.7",
73+
"css-loader": "^6.2.0",
7474
"del": "^6.0.0",
75-
"del-cli": "^3.0.1",
75+
"del-cli": "^4.0.1",
7676
"enhanced-resolve": "^5.8.2",
7777
"eslint": "^7.30.0",
7878
"eslint-config-prettier": "^8.3.0",
@@ -92,7 +92,7 @@
9292
"sass": "^1.35.2",
9393
"semver": "^7.3.5",
9494
"standard-version": "^9.3.1",
95-
"style-loader": "^2.0.0",
95+
"style-loader": "^3.2.1",
9696
"webpack": "^5.45.1"
9797
},
9898
"keywords": [

src/utils.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,10 @@ async function getSassOptions(
168168
: content;
169169

170170
// opt.outputStyle
171-
if (!options.outputStyle && isProductionLikeMode(loaderContext)) {
171+
if (
172+
typeof options.outputStyle === "undefined" &&
173+
isProductionLikeMode(loaderContext)
174+
) {
172175
options.outputStyle = "compressed";
173176
}
174177

@@ -224,6 +227,10 @@ async function getSassOptions(
224227
: []
225228
);
226229

230+
if (typeof options.charset === "undefined") {
231+
options.charset = true;
232+
}
233+
227234
return options;
228235
}
229236

0 commit comments

Comments
 (0)