This error occurs when the first answer that an integration gives the stylesheet loader does not contain exactly one stylesheet. The first answer is the root stylesheet. The loader then asks for the imports that the root contains.
Reported
import { NativeDesignSystemLoader } from "@stillwind/native";
const loader = new NativeDesignSystemLoader();
loader.provideMany([
{ id: 0, name: "root.css", content: '@import "./tokens.css";' },
{ id: 1, name: "tokens.css", content: "@theme { --color-brand: red; }" },
]);SW32002: initial provide must contain exactly one file (conventionally ID 0), got 2
Fixed
import { NativeDesignSystemLoader } from "@stillwind/native";
const loader = new NativeDesignSystemLoader();
const step = loader.provide(0, "root.css", '@import "./tokens.css";');
if (step.kind === "needFile") {
for (const request of step.requests) {
loader.provide(request.id, "tokens.css", "@theme { --color-brand: red; }");
}
}How to fix
- With an official integration, update the Stillwind packages. If the error remains, report it.
- In your own integration, give only the root stylesheet first, and answer the later requests with the IDs that the loader returns.