BuilderIO / mitosis

Write components once, run everywhere. Compiles to React, Vue, Qwik, Solid, Angular, Svelte, and more.
https://mitosis.builder.io
MIT License
12.36k stars 549 forks source link

Qwik adds js / ts extension on import #1465

Open bastiW opened 4 months ago

bastiW commented 4 months ago

I am interested in helping provide a fix!

Yes

Which generators are impacted?

Reproduction case

https://mitosis.builder.io/playground/?code=JYWwDg9gTgLgBAZQiApgYWZAdir8BmUycA5AHQD0AzsigLQDGmEOeZANsDCiQNwBQ%2FFAA9IsOABMU%2BAIYBXdgTlYGMYCzgZwLXDADyANxRQDwFAHcAFAEo4Ab35w4UFDDlQscS46dwAPAB8Pr7%2BSKha2LoBfhRh6MysMEEhMUE%2B1gIAvvxAA

Expected Behaviour

Should not add .jsx or .tsx on import

Actual Behaviour

image

Additional Information

I have the following setting in my mitosis.config.js

    qwik: {
      typescript: true,
      preserveFileExtensions: false
    },
sidmohanty11 commented 3 months ago

@bastiW thanks for raising this, we have a helper already for this called explicitImportFileExtension but seems like its not added for qwik

we can reuse explicitImportFileExtension for qwik something like this,

https://github.com/BuilderIO/mitosis/blob/a51cd1bf3f240405ff8291fe9641d64ceeef0d5d/packages/core/src/helpers/component-file-extensions.ts#L150

in

https://github.com/BuilderIO/mitosis/blob/a51cd1bf3f240405ff8291fe9641d64ceeef0d5d/packages/core/src/helpers/component-file-extensions.ts#L136

JerryWu1234 commented 1 month ago

should specify this demand more clear.