slint-ui/slint · error · Error

slint-ui-dev must not be imported directly — it only provide

Error message

slint-ui-dev must not be imported directly — it only provides the development binary for slint-ui. Import from "slint-ui" instead; having slint-ui-dev installed as a devDependency is enough to enable the development binary.

What it means

slint-ui-dev is a companion npm package that only ships the development native binary for slint-ui (system testing, MCP support), exposed via its "slint-ui-dev/loader" subpath which slint-ui itself loads. Its root entry index.cjs contains nothing but a `throw new Error(...)` so that importing the package directly fails loudly with guidance. Having it in devDependencies is sufficient; its code is never meant to be imported by applications.

Source

Thrown at api/node/dev-package/index.cjs:11

// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

// slint-ui-dev only provides the development native binary for slint-ui; it is
// not meant to be imported directly. The actual binary is exposed via the
// "slint-ui-dev/loader" subpath, which slint-ui loads internally. Importing this
// package directly is almost always a mistake, so fail loudly with a hint.

"use strict";

throw new Error(
    "slint-ui-dev must not be imported directly — it only provides the " +
        'development binary for slint-ui. Import from "slint-ui" instead; having ' +
        "slint-ui-dev installed as a devDependency is enough to enable the " +
        "development binary.",
);

View on GitHub (pinned to a9ea814a58)

Solutions

  1. Change the import to the main package: `import ... from "slint-ui"` (or require("slint-ui")).
  2. Keep slint-ui-dev only in devDependencies; that alone enables the development binary for slint-ui.
  3. Remove any code or bundler entry that references the slint-ui-dev root; never import "slint-ui-dev/loader" yourself either — slint-ui does that internally.

Example fix

// before
const slint = require("slint-ui-dev"); // throws on import

// after
const slint = require("slint-ui"); // devDependency slint-ui-dev stays untouched
Defensive patterns

Strategy: validation

Validate before calling

// Preflight: fail if any source references the slint-ui-dev root entry
const { execSync } = require("node:child_process");
const hits = execSync("grep -rn --include=*.js --include=*.ts -E '(from|require\\()\\s*[\\"'\']slint-ui-dev[\\"\']' src", { encoding: "utf8" });
if (hits.trim()) { console.error("Direct import of slint-ui-dev found:\n" + hits); process.exit(1); }

Prevention

When it happens

Trigger: Any `import "slint-ui-dev"`, `require("slint-ui-dev")`, or bundler/test-runner that resolves the package root (its `main`/exports ".") throws at module-load time. Only the "./loader" subpath is real, and only slint-ui is supposed to require it.

Common situations: A developer installs slint-ui-dev and imports it believing it is the UI API; an IDE auto-import picks slint-ui-dev over slint-ui; a test harness eagerly requires every package in node_modules; a bundler config lists it as an entry or external with root access.

Related errors


AI-assisted analysis of slint-ui/slint@a9ea814a58 (2026-08-16). Data as JSON: /api/errors/e414c405b6018da9. Report an issue: GitHub.