fix(module-builder): a module's tsconfig is not the builder's business #32
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/module-builder-tsconfig"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Split out of #31 at Julian's request: these are the only changed lines that
alter production build behaviour for every module, and they fix a bug that is
disabling a module in the field right now. #31 keeps the component kit and
will rebase on top of this.
The bug
Vite loads the nearest
tsconfig.jsonwhen it transforms a module's.tsfiles. Every module config in this repository does
and says, in a comment, that "an external module repository would carry a file
exactly like this one." In a clone at
/data/modules/src/<name>/that targetdoes not exist, so the parse throws, the frontend build fails, and the host
disables the module at startup — a notification, not a red build. A module
authored to our own documented convention took itself down.
Passing
tsconfigRawas a string is what skips the lookup; an object stillreads the file and merges over it, which is the same crash.
Changes since the review
Options stated, not blanked.
"{}"would have meant esbuild's defaults —class fields lowered to constructor assignment, type-only imports elided
while
check:sveltestill requiresimport type. It now carries exactlywhat module builds were inheriting through
extends, so no emitted codechanges:
Tests. The config is now separable from running it (
moduleBuildConfig),so one test reads the decisions without a build. Three in total: the options
are what we say and are a string; a module whose tsconfig cannot resolve its
extendsstill builds; the import contract still rejects a bare specifier.Checked they fail for the right reason — rewriting the value as
tsconfigRaw: { compilerOptions: … }, the spelling the review predictedsomeone would reach for, fails both new tests with the original
TSConfckParseError: failed to resolve "extends".They run as
deno task test:builder, added toci: importing vite readsos.release()and esbuild spawns its service binary, so this is the oneplace needing unrestricted
--allow-run, andteststays narrow (it nowignores this package).
Docs.
docs/modules.mdgains "Your tsconfig.json governs your editor,not the build" — that nothing in it reaches the output, why that keeps a
module loadable, and the two safe ways to keep one (
tsconfig.check.jsonpassed explicitly to svelte-check, or no
extendsoutside your own repo).Verification
deno task checkclean,deno fmt/deno lintclean,deno task test:builder3/3. Behaviourally: the filebrowser module, cloned as an external module the
way modules actually deploy, went from
external module skippedat thefrontend-build stage to loading and serving its pages.
Based on current main, so no conflicts.
Reviewed the full diff plus the claims in the description.
extendssupplied" claim:tsconfig.svelte.jsoncarriestarget: ESNextandverbatimModuleSyntax.useDefineForClassFieldsis not literally in that file, but it defaults to true at target ES2022+, so stating it explicitly emits identical code.module,moduleResolution,lib,strict,isolatedModules,paths) don't affect esbuild's transform output; vite does its own resolution. Nothing relevant is lost.extendsconfigs for svelte-check only — their builds are unchanged.testignorespackages/module-builder,test:builderis the single place with unrestricted--allow-run, and it runs inci.No findings. Ready to merge.