Open aardvarkk opened 2 years ago
Latest commit: 16eb92c1b4847bd03855fb0e173ca65ce08d1b98
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/pikapkg/snowpack/3PA4cScJCtGDFXh9ZZfYQVz97zJv
✅ Preview: https://snowpack-git-fork-aardvarkk-main-pikapkg.vercel.app
When building a TS file with only types, esbuild strips out all of the type info and returns an empty string as the result of the compilation (
''
).loadUrl()
just does a falsy check on the return value fromfileBuilder.getResult
, which can be any ofstring | Buffer | undefined
. When the empty string is returned, the falsy check doesn't pass, so the load appears to be unsuccessful even though the empty string indicates successful output. Changing the falsy check to an explicit check forundefined
allows the empty string to be treated as a successful response.An alternative to this approach might be to just ignore the import entirely (somehow) if the response is empty. That would potentially save a bunch of useless requests from being sent. But this is at least a step in the right direction that helps code like this to be runnable at least.
Changes
''
) when being compiled by esbuildTesting
build
command fails with a slew of "Module not found" errorsbuild
command succeedsDocs