{"record":{"id":"e414c405b6018da9","repo":"slint-ui/slint","slug":"slint-ui-dev-must-not-be-imported-directly-it-on","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/node/dev-package/index.cjs","lineNumber":11,"sourceCode":"// Copyright © SixtyFPS GmbH <info@slint.dev>\n// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0\n\n// slint-ui-dev only provides the development native binary for slint-ui; it is\n// not meant to be imported directly. The actual binary is exposed via the\n// \"slint-ui-dev/loader\" subpath, which slint-ui loads internally. Importing this\n// package directly is almost always a mistake, so fail loudly with a hint.\n\n\"use strict\";\n\nthrow new Error(\n    \"slint-ui-dev must not be imported directly — it only provides the \" +\n        'development binary for slint-ui. Import from \"slint-ui\" instead; having ' +\n        \"slint-ui-dev installed as a devDependency is enough to enable the \" +\n        \"development binary.\",\n);\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/slint-ui/slint/blob/a9ea814a5813e7460fa1a867924872095a4d678d/api/node/dev-package/index.cjs#L1-L17","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the import to the main package: `import ... from \"slint-ui\"` (or require(\"slint-ui\")).","Keep slint-ui-dev only in devDependencies; that alone enables the development binary for slint-ui.","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."],"exampleFix":"// before\nconst slint = require(\"slint-ui-dev\"); // throws on import\n\n// after\nconst slint = require(\"slint-ui\"); // devDependency slint-ui-dev stays untouched","handlingStrategy":"validation","validationCode":"// Preflight: fail if any source references the slint-ui-dev root entry\nconst { execSync } = require(\"node:child_process\");\nconst hits = execSync(\"grep -rn --include=*.js --include=*.ts -E '(from|require\\\\()\\\\s*[\\\\\"'\\']slint-ui-dev[\\\\\"\\']' src\", { encoding: \"utf8\" });\nif (hits.trim()) { console.error(\"Direct import of slint-ui-dev found:\\n\" + hits); process.exit(1); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep slint-ui-dev in devDependencies only and never import it in application code.","Configure your IDE/bundler so only slint-ui resolves as the API package.","Add an ESLint no-restricted-imports rule for 'slint-ui-dev'."],"tags":["npm","packaging","import","nodejs","slint"],"backgroundTag":"wrong-package-import","analyzedSha":"a9ea814a5813e7460fa1a867924872095a4d678d","analyzedAt":"2026-08-16T22:39:12.830Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}