roxiness / routify-starter

https://example.routify.dev/
198 stars 55 forks source link

Update Rollup Copy plugin to prevent duplication. #47

Closed alteredorange closed 4 years ago

alteredorange commented 4 years ago

Current copy command copies static folder recursively. If you have a large number of static assets multiple levels deep, everything will be copied twice (once to /dist/* and once to /dist/correctfolder/. If you have hundreds or thousands of files in static, this might impact build time. Just copying the static dir with / instead of / appears to fix this issue. It also remove the additional step of del.sync(distDir + '/') and the del import.

vercel[bot] commented 4 years ago

This pull request is being automatically deployed with Vercel (learn more). To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/jakobrosenberg/routify-starter/r7efmoxw5 ✅ Preview: https://routify-starter-git-fork-alteredorange-master.jakobrosenberg.now.sh

jakobrosenberg commented 4 years ago

Thanks for the PR. What's the reasoning behind removing del?

@rixo would this work with your rollup-plugin-copy-watcher?

alteredorange commented 4 years ago

Oops, sorry didn't mean to remove del, I thought it was deleting the double copied files. I see it's what's used to delete the whole directory when building, my mistake!

rixo commented 4 years ago

@jakobrosenberg Well, if it works with rollup-plugin-copy, it should work with rollup-plugin-copy-watch. I just added chokidar, and on change to the designated targets, it dumbly reruns the whole copy operation of the original plugin...

I also tested the assumption and, indeed, this silly plugin doesn't dedup files, so I also think the fix is needed.

del should stay though, except if I'm missing something too.

jakobrosenberg commented 4 years ago

@alteredorange if you make a pr for the beta branch I'll merge it. Remember del.

alteredorange commented 4 years ago

Super, I fixed the del issue and added a pr for the beta branch. Thanks!