Should output UTF-8 BOM when input contains UTF-8 BOM
See original GitHub issueBug report
When integrate with sass-loader, it will output CSS with UTF-8 BOM (i.e. \uFEFF) at the beginning of the CSS when it is run in production mode. But this plugin seems trimmed the UTF-8 BOM in the final output CSS file.
This is a reproducible sample repository (https://github.com/sammyhk/scss-utf8.git).
Execute npm run sass
which call sass directly produce the CSS file (./dist/in.scss.bom.min.css
) with UTF-8 BOM included.
Execute npm run build
which involve webpack, sass-loader and this plugin produce the CSS file (./dist/in.scss.min.css
) without UTF-8 BOM.
Actual Behavior
Seems this plugin trimmed the UTF-8 BOM and output CSS file without BOM.
Expected Behavior
Should preserve the UTF-8 BOM if exists and output CSS file with BOM.
How Do We Reproduce?
This is a reproducible sample repository (https://github.com/sammyhk/scss-utf8.git).
Execute npm run sass
which call sass directly produce the CSS file (./dist/in.scss.bom.min.css
) with UTF-8 BOM included.
Execute npm run build
which involve webpack, sass-loader and this plugin produce the CSS file (./dist/in.scss.min.css
) without UTF-8 BOM.
Please paste the results of npx webpack-cli info
here, and mention other relevant information
System: OS: Windows 10 10.0.19042 CPU: (8) x64 Intel® Core™ i7-10510U CPU @ 1.80GHz Memory: 2.59 GB / 15.79 GB Binaries: Node: 12.22.4 - C:\Program Files\nodejs\node.EXE npm: 6.14.14 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 92.0.4515.131 Edge: Spartan (44.19041.1023.0), Chromium (92.0.902.84) Internet Explorer: 11.0.19041.1 Packages: html-webpack-plugin: ^5.3.2 => 5.3.2 webpack: ^5.51.2 => 5.51.2 webpack-cli: ^4.8.0 => 4.8.0 webpack-dev-server: ^4.1.0 => 4.1.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (10 by maintainers)
Honestly we have here to remove BOM in
webpack
, some developers want to keep them, some to remove 😕dart-sass
adds@charset
when you have non ascii characters in your file https://github.com/webpack-contrib/sass-loader/pull/985/ (need update to the latest version), so now we should handle it forcss-loader
and problems will be solved