Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solid: generated component updates library index.ts with wrong extension #1162

Open
ricrac-hac opened this issue Dec 15, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@ricrac-hac
Copy link

ricrac-hac commented Dec 15, 2024

Describe the bug
When generating a solid component, the library/src/index.ts gets updated with a .ts instead of a .tsx import

To Reproduce

npx create-nx-workspace --preset=apps solid-test
cd solid-test
npm i @nxext/solid
nx g @nxext/solid:application apps/app-web
nx g @nxext/solid:lib libs/lib-app-web
nx g @nxext/solid:component hello --project lib-app-web
cat libs/lib-app-web/src/index.ts

$ cat libs/lib-app-web/src/index.ts

export {};

export { default as Hello } from './components/hello/Hello.ts';

Expected behavior
libs/lib-app-web/src/index.ts should import Hello or Hello.tsx instead of Hello.ts

Note that using .ts or .tsx causes TS5097: An import path can only end with a .tsx extension when allowImportingTsExtensions is enabled. so if we want to keep with .tsx then we also need to update the tsconfig to allow this.

I expect it'd be better to remove the extension entirely for wider compatibility if built libs need to be used outside of a typescript context. I don't have a lot of experience with this though so maybe someone else can weigh in here.

Additional context
Problem also existed in a pnpm based project. Recreated with npm to remove variables

$ nx --version

Nx Version:
- Local: v20.2.2
- Global: v20.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant