QwikDev / astro

Qwik + Astro integration
216 stars 13 forks source link

Page not included in build when directory of same name exists in `public`-directory #68

Closed FloezeTv closed 8 months ago

FloezeTv commented 8 months ago

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

Reason

During build, files/directories from dist are moved to a temp-directory. At this time, it seems the files from public already exists in dist but the pages have not been built yet. Then, qwik runs its build in that temp-directory and astro builds the static pages in the dist-directory. Qwik then moves all files/directories directly in the temp-directory back to the dist-directory. In this case, this overwrites the generated page in the some_page-directory with the previously moved version from the public-directory.

A simple fix would be to replace fsExtra.move with fsExtra.copy, as this seems to merge the directories correctly (at the cost of having to duplicate the data). This merging-behavior for fsExtra.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.

thejackshelton commented 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.

FloezeTv commented 8 months ago

Hey @thejackshelton, I have created a pull request. Let me know if that works or if it needs any further changes. :smiley: