globalFontFace breaks vite/vike build (vite-plugin)
dfrkp opened this issue · comments
Martin Schulze commented
Describe the bug
After adding this snippet in my small vike project:
globalFontFace("Bai Jamjuree", {
fontDisplay: "swap",
src: 'url("/fonts/bai-jamjuree-latin-200-normal.woff2")',
fontStyle: "normal",
fontWeight: "200",
});
I started getting build errors (dev still works):
➜ path git:(main) ✗ npm run build
> build
> vite build
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.0.6 building for production...
✓ 173 modules transformed.
[vite:css] [postcss] /path/renderer/layout.css.ts.vanilla.css:60:19: Unknown word
file: /path/renderer/layout.css.ts.vanilla.css:60:18
error during build:
CssSyntaxError: [postcss] /path/renderer/layout.css.ts.vanilla.css:60:19: Unknown word
at Input.error (/path/node_modules/postcss/lib/input.js:106:16)
at Parser.unknownWord (/path/node_modules/postcss/lib/parser.js:594:22)
at Parser.other (/path/node_modules/postcss/lib/parser.js:436:12)
at Parser.parse (/path/node_modules/postcss/lib/parser.js:471:16)
at parse (/path/node_modules/postcss/lib/parse.js:11:12)
at new LazyResult (/path/node_modules/postcss/lib/lazy-result.js:133:16)
at Processor.process (/path/node_modules/postcss/lib/processor.js:53:14)
at compileCSS (file:///path/node_modules/vite/dist/node/chunks/dep-YJaePtkC.js:39641:63)
at Object.transform (file:///path/node_modules/vite/dist/node/chunks/dep-YJaePtkC.js:39014:56)
at transform (file:///path/node_modules/rollup/dist/es/shared/node-entry.js:17507:16)
at ModuleLoader.addModuleSource (file:///path/node_modules/rollup/dist/es/shared/node-entry.js:17724:36)
Reproduction
n/a
System Info
System:
OS: macOS 14.1.2
CPU: (12) arm64 Apple M2 Pro
Memory: 383.45 MB / 32.00 GB
Shell: 5.9 - /opt/homebrew/bin/zsh
Binaries:
Node: 21.3.0 - /opt/homebrew/bin/node
npm: 10.2.4 - /opt/homebrew/bin/npm
Browsers:
Safari: 17.1.2
Used Package Manager
npm
Logs
No response
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Adam Skoufis commented
@dfrkp I can't reproduce this in a local vite app. Maybe this is an issue specific to vike? A minimal reproduction would be very much appreciated.