Skip to content

CSS with encoding UTF-8 with BOM generates \feff #10043

@daveychu

Description

@daveychu

Describe the bug

I'm including multiple .css files via link
What I expect is that npm run dev and npm run build && npm run preview have the same styling
What actually happens is that the first entry in the second .css file breaks because Vite generates \feff in the output

Reproduction

https://github.com/daveychu/vite-css-utf-8-with-bom-bug

Run npm run dev -> Red text
Run npm run build && npm run preview -> Not red text
See dist\assets\*.css for \feff

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz     
    Memory: 5.14 GB / 15.95 GB
  Binaries:
    Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.27)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    vite: ^3.1.0 => 3.1.0

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    inconsistencyInconsistency between dev & buildp2-edge-caseBug, but has workaround or limited in scope (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions