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
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
Expected behavior
libs/lib-app-web/src/index.tsshould importHelloorHello.tsxinstead ofHello.tsNote 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.tsxthen 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