-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Consider moving client/extensions to extensions #14772
Comments
I think the changes look good here. My concern would be bloating the server bundle, as we add more extensions — is this a valid concern? I haven't looked too deeply yet. |
With renaming |
Interesting fact: how they deal with shared code at Facebook.
|
I double checked usages like import { LOADING } from 'woocommerce/state/constants';. It looks like it would be even more convenience to teach Webpack to change module resolution system to scan imports inside extensions this way: // file: client/extensions/woocommerce/state/sites/shipping-methods/reducer.js
import { LOADING } from 'state/constants'; would search for file in this order for client:
would search for file in this order for server:
This would ensure that code inside extension takes always precedence over all global code. This would also help us to mitigate the issue where extension developers import code from other extensions. I assume it is doable with Webpack given its flexibility. Unfortunately it wouldn't be as easy to setup with Mocha. |
BTW, should we close this and continue in #2319? |
I don't personally have any issue with importing from |
BTW, one of the things I'm watching for on this is compatibility with non-wpcom implementations of this. Eventually, we'll likely want to be able to run the same extension code either within wpcom or outside of it. We'll need to be able to support imports like this in both environments. |
I see these as two separate issues that could be solved by the same PR. We've got them linked, so we'll keep track, but I think the comment threads can continue separately. |
This limitation works the other way around, too. If we pick the same name for extension as the existing subfolder in {
"packages": [ "client/extensions/*", "client/*", "server/*" ]
} I'm not quite sure how all such packages would depend on each other, but it actually might enforce prefixing client or server imports with the proper package name. So to access global Redux state you would have to type |
I find this very unlikely, since the name of extensions is the name of the plugin they support at this moment. In fact, we could even add that to the linter process to enforce it doesn't happen. Here's what we've got so far: hello-dolly Those are nowhere close to any normal subdirectory under |
This issue has been marked as stale and will be closed in seven days. This happened because:
You can keep the issue open by adding a comment. If you do, please provide additional context and explain why you’d like it to remain open. You can also close the issue yourself — if you do, please add a brief explanation. |
For context, this was started by a comment from @gziolo and other comment from @blowery not favoring the way we deal with root import context currently.
This is assuming we want to keep the ability to import relative to an extension in Calypso (e.g.
import X from 'woocommerce/state/action-types'
instead ofimport X from '../../../../action-types'
)If so, then it may make the case for moving
client/extensions
toextensions
so that way we don't have nested import root contexts.I'm logging this issue here with the intent of furthering discussion on this topic.
The text was updated successfully, but these errors were encountered: