diff --git a/apps/landing/src/app/(detail)/docs/limitations/page.mdx b/apps/landing/src/app/(detail)/docs/limitations/page.mdx index dbde17cf3..163d64b62 100644 --- a/apps/landing/src/app/(detail)/docs/limitations/page.mdx +++ b/apps/landing/src/app/(detail)/docs/limitations/page.mdx @@ -96,6 +96,7 @@ A dynamic value such as `width` becomes a CSS variable set in `style`, so a comp - Inside ``, `cx(getClass())` is a build error; put the result in a variable first, which then joins as a class. - `withComponent` takes a tag name or a component written as a name or `a.b`. A target only the runtime knows, as `withComponent(make())`, is a build error: the styled component compiles to a plain function with no `withComponent`. Pass the target directly, or render with `as`. - The plugins read `jsxImportSource` from the `tsconfig.json` (or `jsconfig.json`) in the working directory. Opt out with `importAliases: { '@emotion/react/jsx-runtime': false }`. +- The Bun plugin compiles `.ts`, `.tsx`, `.jsx` and `.mjs` files, but `.js` files only inside `@devup-ui` packages: Devup UI code in a `.js` file of your own project reaches the runtime placeholders. Use `.jsx`, `.tsx` or `.mjs` for it. A Bun runtime plugin must return the source of every file it matches, and Bun reads that source as an ES module, so matching `.js` files would break CommonJS ones. - Code that only the runtime can compute — other globals, `Date`, `Math.random`, `new`, classes, async code — is never run by the build; on an element it stays a CSS variable, elsewhere it is a build error. ## Build errors diff --git a/packages/bun-plugin/README.md b/packages/bun-plugin/README.md index 03b5d0223..3fb45ddf9 100644 --- a/packages/bun-plugin/README.md +++ b/packages/bun-plugin/README.md @@ -60,6 +60,19 @@ module in the bundle. Imports of the packages Devup UI takes the place of Class names are short in `Bun.build` and readable under the runtime; pass `debug` to choose. +## Compiled Files + +`.ts`, `.tsx`, `.jsx` and `.mjs` files are compiled wherever they are, and +`.js` files only inside `@devup-ui` packages. Devup UI code in a `.js` file of +your own project is not compiled and reaches the runtime placeholders +(`Cannot run on the runtime`). Give such files a `.jsx`, `.tsx` or `.mjs` +extension. + +The runtime cannot take those files on. A Bun runtime plugin must return the +source of every file its filter matches, it cannot hand a file back to Bun, and +Bun reads returned source as an ES module, so a CommonJS `.js` file +(`require`, `module.exports`) it matched would stop loading. + ## Compiler Engine The native compiler is selected by default, including the zero-config preload.