dai-shi / waku

⛩️ The minimal React framework
https://waku.gg
MIT License
3.91k stars 102 forks source link

fix: build with customised entriesJs #679

Closed nihgwu closed 2 weeks ago

nihgwu commented 2 weeks ago

We always generate it as entries.js in dist folder, which makes sense if we have something like entriesJs: /foo/bar/baz.start.ts

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Apr 27, 2024 10:00pm
codesandbox-ci[bot] commented 2 weeks ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

dai-shi commented 2 weeks ago

Good point. I didn't mean to support a path in entriesJs. Looking at this, I wonder if we should support customizing entriesJs. 🤔 I thought it's for some advanced users or library authors, but they should then create a vite plugin.

nihgwu commented 2 weeks ago

I need it to run waku at background, not in user's code base, so this is exactly what I need, curious how it can be achieve with vite plugin

dai-shi commented 2 weeks ago

That's interesting to hear. So, do you want to have entries file somewhere else from src? Let me see if I can do something. As this is DEV/BUILD only, we could use environment variables.

nihgwu commented 2 weeks ago

Yes, I don't need pages for routing, just entries.js is enough, and even is I just change the name like entries.js -> start.js, it still fails, so we do need to fix, I understand you point to just use it to change name, but I think my approach can serve more cases, and for those who want to generate it to a different file, just mv after built

dai-shi commented 2 weeks ago

Yeah, it's never tested, and not intended for normal users. Glad to hear you have an interesting use case. I'll work on it and ask you to test it.

dai-shi commented 2 weeks ago

682 is still work in progress, but you can try it.

To customize src/entries.tsx, we need a custom vite plugin. However, I don't think if works if the files imported from there is outside the src folder. #429 is still to be solved.

dai-shi commented 2 weeks ago

This PR will be superseded by #682, but let's keep it open for a while.

dai-shi commented 2 weeks ago

Please open a new discussion if you need help with custom vite plugin.