redwood: [Bug?]: project:sync is broken

What’s not working?

Following the contribution instructions, I’m attempting to work on a Redwood package alongside my existing project. My project is fully up to date.

I’m running into a few fully breaking issues:

It flat out breaks my project

After I run the project:sync command, I see a successful output:

Screenshot 2023-06-09 at 5 10 59 PM

I then run yarn rw dev, but my project now has random breaking issues:

Screenshot 2023-06-09 at 5 12 09 PM

Sync is broken and crashes

I then tried to see if syncing even worked, so I went to the package that I want to work on (auth-providers/dbAuth), and added a simple console log just to see if it would sync. Doing that leads to project:sync crashing:

Screenshot 2023-06-09 at 5 13 37 PM

I’ve run git clean -fxd, yarn cache clean… it seems to be an issue with the project itself.

Am I doing something wrong?

Thanks!

How do we reproduce the bug?

No response

What’s your environment? (If it applies)

No response

Are you interested in working on this?

  • I’m interested in working on this

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 30 (30 by maintainers)

Most upvoted comments

@arimendelow so Vite node_modules caching is definitely a thing and it only re-bundles based on these events, which project:sync doesn’t fall under:

  • Package manager lockfile content, e.g. package-lock.json, yarn.lock, pnpm-lock.yaml or bun.lockb.
  • Patches folder modification time.
  • Relevant fields in your vite.config.js, if present.
  • NODE_ENV value.

Source: https://vitejs.dev/guide/dep-pre-bundling.html#file-system-cache.

We’ll figure out how to make this easier, but for now this should save you from having to do a git clean and rebuild. Start your dev server like this:

yarn rw dev --forward="--force"

Make sure you see this in your terminal:

web | Forced re-optimization of dependencies

You’ll have to restart your dev server every time you make a change, but it’ll be much faster than a full git clean and rebuild.

Thanks @arimendelow I can reproduce that; the first change takes effect but not subsequent ones, even after re-starting the dev server. I’m guessing it has to do with Vite caching, but don’t know for sure so I’ll read up on it and ask the team.

@thedavidprice do you know if there have been meaningful updates to the PR since yesterday? as of yesterday, it still didn’t work (see above)

Yeah there’s been a couple of times when project:sync wouldn’t work for me. I believe there’s a --watch flag which makes it even better, it kind of acts like sync but isn’t quite as fast!

@arimendelow and about the SVG change, yes that’s one of the breaking changes we’re working out for the next major. The change was in this PR: https://github.com/redwoodjs/redwood/pull/8301, and WIP codemod here: https://github.com/redwoodjs/redwood/pull/8564

Hey @arimendelow, I’m actually working on that fixing that error here https://github.com/redwoodjs/redwood/pull/8579. I think I have it fixed and discovered a few more things that weren’t quite right with that script. There’s still a few improvements I want to make, but I think it fixes the issue you’re seeing. Could you confirm for me by pulling down that branch and running yarn rwfw project:sync from there?