-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin system #2784
Plugin system #2784
Conversation
e46cdc2
to
b4bca03
Compare
@@ -114,13 +115,28 @@ inquirer | |||
fs.mkdirSync(path.join(appPath, folder)); | |||
}); | |||
|
|||
let addtlDeps = new Map(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe rename this to additionalDeps? it's not obvious at the first time I read it....
add tl deps, what is tl? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No harm in longer names; I'll change it. 😄
If I could have '
it'd be nice: add'l., addt'l.
addl seemed too (??), so I opted for addtl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or use emojis for language-agnostic interpretation 😄
➕📦 = new Map()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omg I could only imagine someone's face when they see a package emoji as an identifier.
Cleaned up some code and made the Ready for some more review. |
@Timer Hi, could you please elaborate what this means for the end users (app developers), and for the community who forks |
@sompylasar Great question! So, end-users (app developers) will only be able to use plugins which we approve and whitelist.
People who fork That said, people who create forks will be able to create and whitelist their own plugins to be consumed, but these plugins will not work with Unfortunately, it needs to be this way to ensure we can provide a cohesive, updatable experience. |
@Timer Thanks!
Which do you plan to whitelist? TypeScript, obviously. What about CSS modules? What about SCSS? What about having SCSS and CSS modules combined?
How do you determine popularity? What should I do as an advanced app developer who likes CRA developer experience but needs a non-whitelisted feature? Eject is not an option as I'd like to not mess with webpack configs. Have you considered extracting the CRA developer experience (the terminal realtime UI with linter and tests) into a module pluggable to a webpack config?
Could you please rephrase this? "Not work with react-scripts"?
Understood. But I think there will be a multitude of forks with extra plugins enabled that you haven't whitelisted, as is now with the I hope you understand how CRA was a bless after rolling own webpack configs. Even for an advanced dev, it's not scalable enough and it takes a couple months to roll out a system comparable to CRA by developer experience. Thank you. |
We do not have any promised plans yet. CSS modules are most likely going to be enabled as an always-on, supported feature (no plugin needed). Plugins can be combined, so you could add a Scss and CSS modules plugin (if we used plugins for both).
"Popularity" probably isn't the best metric, because we will not support everything popular.
You will be in the same boat which you are now; unable to use the feature without ejecting.
What you are describing is called neutrino. They do this a lot better than us.
I was simply reiterating that plugins will be whitelisted.
I believe this may very well happen in the future when the tools reach a very stable point, but right now there's simply too much churn and I cannot see this ending well. We're just not there yet. |
I would like to hear your thoughts and opinions on what is currently not scalable enough. We're currently in the works to support TypeScript & CSS Modules, which are two largely requested features. |
@Timer Would a plugin similar to the gatsby-source-wordpress be approved? |
I'm not sure how |
The reason I'm asking is because |
It's too early for me to say what plugins may be considered; we're not even sure we want to merge a system like this yet. This all is completely hypothetical. 😄 |
@Timer Thanks for the great responses! I didn't know about neutrino, will have a look. How CRA is different from it then, besides it's by Facebook, not Mozilla?
The following experience of making a build system and improving development experience for a large web app started 1.5 years ago from scratch by taking and then over time heavily upgrading some react-redux-boilerplate. We're using lots of cutting edge features of JavaScript, the front-end, and the Node ecosystem. It's likely not applicable to CRA just because of the scale, but some ideas might be useful. Here are the features that took most of the time (in order of appearance):
Useful things we added to the developer experience:
Note that we haven't had time to implement the nice realtime terminal as we've already spent a lot on internal infrastructure making the above. The tests were also made to run via plain mocha and the default reporter, without the fancy stuff like re-running just the tests for the code that has changed.
Not yet for large apps, we use it for small standalone static frontends (for tools used internally). We'd like to reuse TypeScript modules in CRA-based apps, while keeping React+SASS+CSS modules, which isn't possible as of now (we use
Sure, you're very welcome.
Really promising, thanks! |
Looks like https://neutrino.js.org/ is awesome: easily configurable without diving into webpack configs and has multitude of presets compatible with each other. Thanks again @Timer. I think CRA has just lost me as a customer, I really need to give Neutrino a try. |
Wow @sompylasar! Thanks for the extensive feedback, I really appreciate it.
It seems you've already dug into this more and discovered what neutrino is about. 😄
Thanks for such an exhaustive list! Some of these things CRA already does, but others sound like awesome features which could make improvements. I'm going to keep these noted. 😄
That's fine, it's been nice to have you! neutrino sounds like it will solve your desires much better than we can. |
Any chance that there will be a plugin to enable server-side rendering support? |
Apologies @Timer, but I don't quite understand why you're adamant about plugins being whitelisted by the CRA team, instead of being configurable by end-user developers. If a user is specifically adding a plugin to some kind of configuration (for example, Maybe make some kind of flag to enable non-whitelisted plugins ( Personally, I have seen many libraries that I have passed on because they require changes to Webpack configuration, and I don't want to eject. For instance, Ninja edit: in addition, this could easily lead to accusations of favouritism: for instance, if you were to not approve some Microsoft or Google plugin (for a perfectly valid technical reason), people could easily see that as Facebook attacking Google, no matter how many times you state that it's not "political" but purely technical. Or, some company could create a plugin but refuse to allow it to be whitelisted because "We have control to modify & publish updates to the package" seems like giving Facebook control (cf. React license patents grant debacle). Both React and CRA are Facebook projects, and whatever you guys do, it will be seen as a Facebook action, positive or not. |
So that's why these plugins are white listed. These are feature we want to support, but do not because we'd like to not bloat installations for individuals who do not use them.
There can be a fork which allows users to use non-whitelisted plugins, but not the main repository.
So, I believe this confusion is caused by the name "plugins"; we will never permit "3rd party plugins" because they will break the user experience. IMO, there will be no more "favouritism" than there is now. We currently disallow a number of suggestions which enable language features, libraries, etc. IMO, if users are too up in arms about these issues at the end of the day we will probably forego any plugin/addon system and never support things like TypeScript or Relay. |
@markspolakovs I think that if the proposed extensibility system will go through (which I hope it will!) soon enough a fork enabling non whitelisted add-ons will appear. While this might not seem an improvement over the current situation (i.e. having to use a fork), the benefits would be many:
I think the proposed system, with the whitelisting, is an excellent idea - the only thing I would humbly suggest is not to call it a plug-in system, because I fear the word alone could cause expectations. |
@Timer any idea when this feature might be finished? |
I was excited when I saw this, because I love CRA for the whole fact I can get started without messing with the build setup... I also know Webpack and that very well already, so I'd prefer not to eject for the fact that I'd have to learn all the ways CRA team set up webpack. If I had to eject I'd just go the route of manually setting everything up myself without CRA. The idea of plugins sounded great because then I can use stuff that isn't officially supported but could be community supported... But making it CRA team whitelisted only sounds horrible. :/ |
I think any plugin system, whitelisted or not, is a significant improvement. |
It's worth noting that react-app-rewired could be seen as a poor man's plugin system, and the community growing around it could be seen as validation that the community needs an extensible system. Even as a contributor of a few of the community maintained "rewires" I'd much prefer to see a first-class plugin system in create-react-app as I suspect it would be much easier to maintain a stable ecosystem of extensions. I'd also add that react-app-rewired offers a compelling example of a stable, open system so I'd advocate against the whitelist proposal. CC: @timarney (the react-app-rewired maintainer) |
@Timer I'm a heavy user of CRA, so first I would like to thank you for the great tool, and I really appreciate the effort you put into this project. |
What's blocking this PR from being merged? |
Is the progress on this stalled? Some ability to extend CRA would be very desirable. Just a friendly ping to see how its going! |
If that’s the case then shouldn’t this be closed? |
A plugin system is something which proposes to solve many problems.
For instance, we'd like to be able to add support for things like Relay, without increasing the initial installation size of the build tooling.
This could also be applied to things like TypeScript, Sass, et al.
Design goals:
yarn add react-scripts-plugin-relay
)We need a lot of discussion about this before we can progress further!