Add a compile hint for unsupported stylesheet imports - #5
Open
MohammedAlkindi wants to merge 1 commit into
Open
MohammedAlkindi wants to merge 1 commit into
MohammedAlkindi wants to merge 1 commit into
Conversation
The bundler runs with write disabled and no output path, so esbuild refuses any CSS import and fails the whole build. The message names an internal build option rather than anything in the generated project, so the model has nothing to act on and tends to retry the same import. Add a hint pointing at inline style objects, alongside the existing compile hints. This does not change whether stylesheets are supported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
.cssis inSUPPORTED_FILE_EXTENSIONSandgetLoaderhas a dedicatedcase ".css", but thebuild()call setswrite: falsewith nooutdiroroutfile. esbuild cannot emit CSS without an output path, so any stylesheet import fails the whole build.The model receives
Cannot import "user-file:/src/styles.css" into a JavaScript file without an output path configured, which names a build option it cannot see and gives it nothing to act on. This adds a hint branch alongside the existing ones, pointing at inline style objects.I did not change whether CSS is supported, since that is your call. Worth knowing if you take it up: adding
outdirdoes make it build, butcompileProjectBundlereadsoutputFiles[0]only, so the emitted CSS is dropped and the styles silently never apply. That trades a loud failure for a quiet one.Evidence is a standalone esbuild reproduction against these exact build options: TSX alone compiles, a
.pngdataurl import compiles,.cssfails. There is no test suite here, so no automated fail-before.Disclosure: AI-assisted. I ran that reproduction myself, confirmed the new predicate matches the real error text, and
tsc --noEmitis clean.