Closed FloezeTv closed 8 months ago
Hey @FloezeTv! I was able to reproduce the issue given your detailed steps. We've also had our fair share of weird issues with the build files being moved, especially with Astro's deployment adapters, which I wonder if this could help resolve as well.
Interesting, the package does appear to have a test suite, I wonder if it being cjs would potentially cause any issues (especially with vite's whole esm change)
A PR would be awesome 😄 . Happy to review it asap.
Hey @thejackshelton, I have created a pull request. Let me know if that works or if it needs any further changes. :smiley:
When a directory exists in
public
with the same name as a page and a qwik component exists anywhere in the project, that page is not showing up in the final build.To reproduce
npm create astro@latest
(Empty, with Typescript in Strict mode)npx astro add @qwikdev/astro
and modifytsconfig.json
according to the documentationcp src/pages/index.astro src/pages/some_page.astro
)public
with same name (e.g.,mkdir public/some_page
)src/component.tsx
)npm run build
) and observe thatsome_page
is missing from the build indist
public
is deleted or all qwik components are removedReason
During build, files/directories from
dist
are moved to a temp-directory. At this time, it seems the files frompublic
already exists indist
but the pages have not been built yet. Then, qwik runs its build in that temp-directory and astro builds the static pages in thedist
-directory. Qwik then moves all files/directories directly in the temp-directory back to thedist
-directory. In this case, this overwrites the generated page in thesome_page
-directory with the previously moved version from thepublic
-directory.A simple fix would be to replace
fsExtra.move
withfsExtra.copy
, as this seems to merge the directories correctly (at the cost of having to duplicate the data). This merging-behavior forfsExtra.move
was discussed in https://github.com/jprichardson/node-fs-extra/issues/668, but apparently only implemented in a separate package.Depending on how you would want to resolve this issue, I can look into creating a pull-request if you want.