Closed harrysolovay closed 5 years ago
Hi @stereobooster — just wanted to ping this thread again incase you didn’t see it! Hope you’re having a fantastic Saturday night 🥳
Short answer: yes I saw it, but this will not land any time soon, because I have different plans. Long answer: I need time to write it down (which I don't have right now)
You can install your fork (with npm or yarn) from Github url if you want to use it right now
Longer answer: There is roadmap which specifies what is planned next https://github.com/stereobooster/react-snap/issues/90#issuecomment-444283627. So this PR won't be merged until v2 released. We can get back to it after v2
Hi @stereobooster sorry for the delayed response. I'd love to be part of that discussion and urge you to check out the project for which I wanted to create a react-snap plugin. Given that rescripts allows you to safely edit the build process, there could be a good fit for us to collaborate. While the Rescripts framework is tied to CRA, I think it would be best to build a new version react-snap as build-system-agnostic. Even though non-CRA devs are probably using either Gatsby or Next and therefore wouldn't use react-snap. Please let me know how I can be of help to you in working on a new version. Are you debating certain DX decisions? I'm really excited by the idea of helping to make this snapshotting technique simpler, more robust, and into an all-in-all must-have default for CRA.
I think it would be best to build a new version react-snap as build-system-agnostic
Maybe I didn't understand you, but generally react-snap is build-system-agnostic. There is workaround for webpack chunks, which is enabled by default, and can be disabled. I was able to snapshot vue project, for example.
I will check rescripts link later
@stereobooster gotcha. That's my favorite part of snapshotting :)
Looking forward to hearing your thoughts on rescripts and the future of react-snap!
I checked rescripts. Can you please describe scenario where you would need to pass configuration, like that
For sure. I would want to trigger react-snap as part of the build process. At first I was thinking I could import the package.json, modify it to have the react-snap config and postbuild script, and then cache the updated package. Unfortunately—this approach doesn’t work, as the instance is already running with the unmodified package.json (aka. no postbuild script is visible to the instance). I need a way to trigger react-snap as the last step in my build process... I was thinking I could create another package which triggers react-snap elsewhere... but there’re scope access issues. Ideally we could have react-snap as a CLI tool (triggered within a rescript). What’re your thoughts?
why can't you just run yarn react-snap
? react-snap
works without configuration out of the box with CRA. You don't need to touch package.json
My understanding was that there’s some required configuration for 404s and CSS scraping. I’ll try it out though & let you know how it’s working. Thanks @stereobooster!
I guess I answered your question. If you have more question please. Will close this for now
@stereobooster yea, sorry about that. I've been digging into some options that work well with suspense. Thank you so much for all your support!
Hi,
I'm working on a tool that applies react-snap configuration at runtime. At first, I tried monkeypatching
package.json
, but that was a no-go (since the instance is already-running, it can't be swapped out through require.cache). With this PR, you should be able to place react-snap configuration inside of a file (absolute, in node_modules or relative the root directory––should work all the same), and then reference that configuration file in the postbuild script:One benefit of this is that you could create and publish default configurations for common environments like CRA. That way, people could configure react-snap with even less config!!!
Please make sure to test it out for yourself incase I'm overlooking anything architecturally. I'm really hoping this passes through! It would make my life a lot easier (no pressure though ;).
Thanks,
Harry