-
Notifications
You must be signed in to change notification settings - Fork 613
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
[rush] Design Idea: rush-sdk should be loaded explicitly #3209
Comments
Of the two, I think I prefer (1), because it changes the api the least -- require still does the loading and confirmation. Another option in my opinion would be to add the { RushSdkLoader } interface where you can control when and how the api is loaded, but if you don't use it, continue to support the "magic" version already implemented. This works both for one-off user land scripts and for larger scripts that need to exert more control. |
I agree with @elliot-nelson. I put that together here: #3212 |
+1 for Approach 1. For now, call |
Summary
Under the current design, if a standalone tool calls
require('@rushstack/rush-sdk')
this may..This magic has a few downsides:
require('@rushstack/rush-sdk')
, nothing about the API signature indicates that this particular call is different from a conventional importrequire('@rushstack/rush-sdk')
Improved Approach 1
Suppose that we change the design so that a special startup call is required to load
rush-sdk
:The special startup call should get executed at the very beginning of your tool/script before other dependencies are imported:
Improved Approach 2
Rather than having a special entry point
require('rush-sdk/loader')
, maybe we could fold this definition into the proxy somehow?This is more concise, but slightly more magical. Maybe Webpack would have trouble bundling it?
CC @iclanton @elliot-nelson @chengcyber
The text was updated successfully, but these errors were encountered: