New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[unocss:global:build:generate] [unocss] does not found CSS placeholder in the generated chunks #1341
Comments
With lib mode in vite.js, the option And, build.cssCodeSplit=false, the unocss will occur this error. That is to say, you can manual set it to |
These steps worked for me, it's for mode "global", but you can play with other modes to seek the correct config:
build: {
lib: {
entry: resolve(__dirname, "index.ts"),
name: "xxx",
},
rollupOptions: {
output: [
...
{
dir: "dist/umd",
format: "umd",
name: "xxx",
sourcemap: false,
}
...
]
}
} but you can specify entryFilenames for es and cjs Unocss: v0.44.7 |
above config only works for umd. For iife, after set build.cssCodeSplit = true, it's a hit and miss, you build several times, it might succeed one time. The inconsistency looks like a parallel async bug. but just use umd for now would be fine I guess. |
@Xwudao you might want to be able to export the styles in your library to be imported separately by the consume in lib mode. |
@ckvv it must be something recent because I fixed it by downgrading to |
I'm having the same problem with Astro. In dev mode everything works fine but when I build the project, it fails. astro.config.mjs import { defineConfig } from 'astro/config';
import { presetUno } from "unocss";
import unocss from "unocss/vite";
import icons from "@unocss/preset-icons";
import svelte from "@astrojs/svelte";
import { extractorSvelte } from "@unocss/core";
export default defineConfig({
integrations: [svelte()],
vite: {
plugins: [
unocss({
presets: [
presetUno(),
icons()
],
extractors: [extractorSvelte],
}),
],
ssr: {
noExternal: ["modern-normalize"]
}
}
}); layout.astro ---
import "modern-normalize";
import "uno.css";
import "../main.scss"
import Header from "../layouts/header.astro";
---
<some-markup> |
we said set it to |
This is probable related to https://github.com/vitejs/vite/discussions/9443 |
Did not help either. According to vite docs true is the default |
This actually fixed the issue for me. |
https://github.com/ckvv/vite-project
The following error is thrown when the output file is multiple in library mode
https://github.com/ckvv/vite-project/blob/3b4f3c84c2b9cd4f0e0ee883da6439077cad1811/vite.config.js#L12
The problem occurs in version v0.43.2
related to this commit#1217
The text was updated successfully, but these errors were encountered: