moi-computer 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/build-applet.ts +11 -0
package/package.json
CHANGED
package/server/build-applet.ts
CHANGED
|
@@ -10,6 +10,8 @@ import { basename, dirname, join, relative, sep } from 'path'
|
|
|
10
10
|
|
|
11
11
|
import type { ViewConfig, WidgetConfig } from '@/lib/types'
|
|
12
12
|
|
|
13
|
+
import { prebuilt } from './static'
|
|
14
|
+
|
|
13
15
|
// An **applet** is any custom UI unit embedded in a workspace; `widget` and
|
|
14
16
|
// `view` are its kinds (more may follow). All compile through this pipeline —
|
|
15
17
|
// `kind` only diverges at the edges: which `config` schema is parsed, the
|
|
@@ -519,6 +521,15 @@ export async function buildApplet(
|
|
|
519
521
|
target: 'browser',
|
|
520
522
|
sourcemap: 'inline',
|
|
521
523
|
external: EXTERNAL_MODULES,
|
|
524
|
+
// Pin the JSX runtime to match the React build the vendor route serves
|
|
525
|
+
// (server/vendor.ts keys off the same `prebuilt` flag): production emits
|
|
526
|
+
// `jsx`/`jsxs` (react/jsx-runtime), development emits `jsxDEV`
|
|
527
|
+
// (react/jsx-dev-runtime). Without this, Bun defaults to `jsxDEV` (the
|
|
528
|
+
// widget `root` dir has no tsconfig to say otherwise), which crashes in a
|
|
529
|
+
// prebuilt/global install where the production React has `jsxDEV === undefined`.
|
|
530
|
+
define: {
|
|
531
|
+
'process.env.NODE_ENV': JSON.stringify(prebuilt ? 'production' : 'development')
|
|
532
|
+
},
|
|
522
533
|
// The bundle is a directory: a fixed `index.js` entry (the client
|
|
523
534
|
// dynamic-imports it) plus content-hashed `chunk-*.js` for any dynamic
|
|
524
535
|
// imports. Assets are emitted by the runtime plugin, not here. `[ext]` is
|