Skip to content

oj v0.2.30

Choose a tag to compare

@github-actions github-actions released this 14 Oct 08:05
· 78 commits to main since this release
e1d8eb0

Fixed

  • Start dev picks up a src/start.ts created or deleted while the server runs. The start entry is resolved once, in the framework plugin's config hook upstream and at boot in oj, so a presence flip now restarts the dev server the way Vite restarts for its config-shaped inputs (config file, config dependencies, env files; Vite's restart branch runs for create and delete too). Previously the create matched no served graph and nothing rebundled, so global createStart middleware silently never ran, and the next unrelated rebundle half-applied it: the client bundle adopted the entry while SSR kept the stub until restart. Edits to an existing src/start.ts stay ordinary rebundles. The client bundle cache also keys on which src/start.* exists, so a boot after the flip bundles the real entry instead of restoring the stale stub bundle (this also fixes adding the entry between runs).
  • A dependency that ships raw TypeScript and imports its own stylesheets (import "./select.css", a CSS module, a JSON file) renders under dev SSR and TanStack Start dev instead of 500ing every route with SyntaxError at the stylesheet's first line. oj transforms such dependency files through the pipeline, but their imports still took the native runtime's Node path, which parsed CSS as JavaScript (and ignored ssr.noExternal and plugins). Vite never externalizes a relative or absolute specifier, so a module it transformed has every import resolved through the plugins; oj now does the same for the dependency modules it claims, while node builtins still short-circuit first.
  • SSR externalization follows Vite's canExternalizeFile: only a dependency file with no extension or .js/.mjs/.cjs may stay external. A bare import "pkg/styles.css" (or a dependency JSON file) under dev SSR is served by the pipeline instead of the runtime, and an SSR production build bundles it instead of leaving an import Node cannot load.
  • CSS modules work under TanStack Start, in dev and in production builds. The client bundles loaded every .css import as an empty module and linked the stylesheet as written, so a .module.css class map was {} in the browser and the sheet's selectors were unscoped, while dev SSR rendered scoped names: nothing was styled, hydration saw different classNames, and a production build rendered no class at all. The Start bundles now take each CSS module from oj's CSS pipeline, the compile dev SSR renders from, so the server, the client's class map and the emitted (or dev-served) stylesheet name the same scoped class, as Vite's single postcss-modules compile does. Scoping runs before Tailwind, as postcss-modules runs before the app's postcss plugins in Vite. Dev SSR CSS modules also honor css.modules (generateScopedName, localsConvention, ...) now, matching the client pipeline.