feat(fastify-htmx): allow for imports without file extensions #200
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.
I noticed that some client imports where not properly included in vite's output. This was the setup:
data.tsx
../components/ListItem.tsx
./ListItem.module.css
I expected the list items to be red but they were not. Upon further investigation, I noticed that the CSS code from
ListItem.module.css
was generated but not included in the output.The problem stemmed from this line in
data.tsx
:The import does not include the file extension but the checks in
findClientImports
rely on the file extension to be present:fastify-vite/packages/fastify-htmx/index.js
Line 152 in 169b718
In this PR I'm adding a step to resolve the file extension in case it's not defined. This allows for imports without file extensions to be correctly resolved and included in the bundle.