fontaine icon indicating copy to clipboard operation
fontaine copied to clipboard

fix: [vite:css-post] [lightningcss minify] Unexpected token CloseParenthesis

Open farshidpg opened this issue 4 months ago • 1 comments

🐛 The bug

Vite lightningcss minify not compatible for production build

🛠️ To reproduce

https://stackblitz.com/edit/github-ck4hvcy1?file=nuxt.config.ts,package.json

🌈 Expected behaviour

Production build pnpm build in Nuxt 3 get error when Vite cssMinify: "lightningcss" and nuxt inlineStyles: false


 ERROR  ✗ Build failed in 5.60s                                                                                                                   6:56:38 PM


 ERROR  Nuxt Build Error: [vite:css-post] [lightningcss minify] Unexpected token CloseParenthesis                                            nuxi 6:56:38 PM

20 |  @font-face{font-family:Roboto;src:local("Roboto Regular Italic"),local("Roboto Italic"),url(/_fonts/2ggHYVDCbvazc1p0t...
21 |  @font-face{font-family:Roboto;src:local("Roboto Regular"),local("Roboto"),url(/_fonts/w6IyUMb7I-Yy2vbAlgUry4sKIBOdeyt...
22 |  ...Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji,);-webkit-font-feature-settings:var(--default-font-fea...
   |                                                                 ^


    at minifyCSS (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:32404:59)
    at async finalizeCss (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:32271:38)
    at async Promise.all (index 1)

 ELIFECYCLE  Command failed with exit code 1.


nuxt.config.ts
nitro:{
      static: false,
      minify: true,
}

features: {
      inlineStyles: false
    },
...
vite: {
      build: {
        sourcemap: false,
        cssMinify: "lightningcss",
        ssrManifest: true,
        minify: "terser",
        chunkSizeWarningLimit: 1024,
      },
}


ℹ️ Additional context

its works without error with esbuild

farshidpg avatar Oct 09 '25 16:10 farshidpg