rails / webpacker

Use Webpack to manage app-like JavaScript modules in Rails
MIT License
5.31k stars 1.47k forks source link

Move react dependencies to docs. #3224

Closed justin808 closed 2 years ago

justin808 commented 2 years ago

This commit removes React dependencies, replacing them with docs.

Here's what changes in my example project with this change:

https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/pull/21/files

I feel that if we're not going to support HMR, then it makes sense to let React configuration be outside of rails/webpacker.

justin808 commented 2 years ago

@guillaumebriday @dhh Should we remove all of React from rails/webpacker?

justin808 commented 2 years ago

@guillaumebriday this is rebased on master.

justin808 commented 2 years ago

I've got a draft NPM package that will make React with SSR and HMR a one-liner for rails/webpacker users: https://github.com/shakacode/react_on_rails_tutorial_with_ssr_and_hmr_fast_refresh/pull/24

Here's the config that takes the docs change and puts it into the NPM module: https://github.com/shakacode/react-on-webpacker/blob/main/babel/preset.js