humanmade / react-wp-scripts

Integrate create-react-app with your WordPress theme/plugin.
235 stars 32 forks source link

Remove react/react-dom/etc from externals #68

Open rmccue opened 3 years ago

rmccue commented 3 years ago

1e26dfd2b160d4b4218efed0ac0c41f7db8f0829 configured react/react-dom/moment as externals. This removes the ability for users to control these scripts, and goes against the original purpose of react-wp-scripts (for SPAs) as it introduces a hard dependency on core's version of these scripts.

(Might be worth a setting of some sort for this?)

roborourke commented 3 years ago

I feel like this is a reasonable default considering this version of react-scripts is geared towards WP and has a significant impact on the end bundle size. Happy to have a flag that sets it otherwise though to cover all the bases / use-cases.

rmccue commented 3 years ago

and has a significant impact on the end bundle size

Users end up loading the same amount of data regardless, so it's not too big of an issue on that front.

roborourke commented 3 years ago

Not if something is loading WP's version of React as well. That's really what this is addressing - the plugin use-case.