You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Unable to build an application using a using a generated solid library, as the vite.config.ts and project.json are written as an application config; not a library.
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
import { Hello } from "@solid-test/lib-app-web"; in apps/app-web/src/App.tsx and place it in the app layout.
> nx run lib-app-web:build:production
vite v5.4.11 building for production...
✓ 0 modules transformed.
x Build failed in 8ms
NX Could not resolve entry module "libs/lib-app-web/index.html".
Pass --verbose to see the stacktrace.
Expected behavior
Build should work.
Additional context
Looking at what happens with the @nx/react generators for libraries, I believe there are a few things needing tweaking but most important of them is that the vite.config.ts and project.json should probably not have the build targets in it.
This is a bit closer to the generated vite.config for the react project; and this builds successfully. and nx run app-web:preview runs successfully
$ nx build app-web
> nx run app-web:build:production
vite v5.4.11 building for production...
✓ 11 modules transformed.
../../dist/apps/app-web/index.html 0.60 kB │ gzip: 0.36 kB
../../dist/apps/app-web/assets/index-kNDHXHrP.css 0.71 kB │ gzip: 0.47 kB
../../dist/apps/app-web/assets/index-k5vfhgCj.js 9.53 kB │ gzip: 3.85 kB
✓ built in 274ms
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target build for project app-web (1s)
I suspect there may be other issues with the lint and test setup as well but I haven't looked much into those yet.
I'm concerned I'm now pushing into spam territory with the recent number of bugs on a similar set of entry points into the project so I will avoid opening any more issues related to "solid project generation". I'm wondering if #1061#1161#1162 and this one should be addressed in one PR since they're kind of all contributing blocks to the process of new project setup and build?
The text was updated successfully, but these errors were encountered:
I did experiment with making vite library build as per https://vite.dev/guide/build.html#library-mode and while this does technically make the error go away; it now generates index.html and css/js files in the dist folder that aren't actually usable by anything.
I suspect this is why the react library doesn't configure it this way.
I do wonder how this will work with lazy imports and code splitting though. https://docs.solidjs.com/reference/component-apis/lazy I am not sure if this is something that the app vite will manage or if the library itself needs to be configured in some way to enable it. I'll play with it later and update here if I see any success.
Also I'm happy to look at making PRs for some of these issues I've raised, but I'm new to nx plugin dev so it might take some time for me to find the right templates and config functions to update.
Describe the bug
Unable to build an application using a using a generated solid library, as the vite.config.ts and project.json are written as an application config; not a library.
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
import { Hello } from "@solid-test/lib-app-web";
inapps/app-web/src/App.tsx
and place it in the app layout.Manually resolve #1061 #1161 and #1162
nx serve app-web
See the app runs,
nx build app-web
see the build fail
Expected behavior
Build should work.
Additional context
Looking at what happens with the @nx/react generators for libraries, I believe there are a few things needing tweaking but most important of them is that the vite.config.ts and project.json should probably not have the build targets in it.
This is a bit closer to the generated vite.config for the react project; and this builds successfully. and
nx run app-web:preview
runs successfullyI suspect there may be other issues with the lint and test setup as well but I haven't looked much into those yet.
I'm concerned I'm now pushing into spam territory with the recent number of bugs on a similar set of entry points into the project so I will avoid opening any more issues related to "solid project generation". I'm wondering if #1061 #1161 #1162 and this one should be addressed in one PR since they're kind of all contributing blocks to the process of new project setup and build?
The text was updated successfully, but these errors were encountered: