-
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
Merging wp-desktop with wp-calypso: Folder structure & webpack resolvers #11603
Comments
Regarding the various options of webpacks resolve config here's A discussion worth noting, (particularly the linked comment) |
I don't think it's luck, the |
Thanks @blowery, I think this is sort of what I was alluding to, but without knowing the details. I think I've just been looking at this for a bit too long without any progress or resolution so I may try another approach! :) |
I do have one related idea that I'm keen to get thoughts on... I think this sort of change could help me with my port as currently I'm trying to resolve this error: uncaughtException (fatal) { Error: Cannot find module "../../client/sections"
at webpackMissingModule (/Users/Spen/Projects/wp-calypso/wp-desktop/build/desktop.js:177379:82) As a result of copying Calypso files in to a build directory. |
How often do we import code cross client/server? Is this really a concern? Do you think there are any trade-offs of having a root |
My concern is actually more about referencing I spent a while trying to work out which Also, I think this is a similar (or the same?) pain point that @ockham was experiencing with certain paths being completely fine withing Calypso, but failing in |
FWIW, this would be my preferred solution. Furthermore, I'd use Calypso's current webpack configs etc as the baseline and consider the ones in
Mine was the inverse situation -- I was So my strategy would be to work out what is actual business logic inside |
This is exactly what I'd like to see happen!
Good point - It's definitely not going to be a simple case of lifting-and-shifting - far from it I think :( |
It's worth mentioning here that I've opened a PR that relates to this issue here: #12537. I still think that there might be value in adding aliases to allow for less ambiguous paths ( Closing this for now, I'll open more targeted issues relating to the above in the future if necessary :) |
I've been tinkering with my first pass at bringing the desktop build process in to Calypso itself.
There are many questions to be answered: how will versioning work? How often should desktop be built how do we build desktop with a specific snapshot of Calypso?; but for now, I just want to tackle some initial hurdles that we'll hit regardless of those logistics.
To me, the most obvious of these is where will the desktop build files live within the Calypso project?
My first thought is to just create a directory at the root level called
/desktop
but I did want to throw this out there and see if anybody can give a good reason why now - maybe it's not descriptive enough, maybe it should be placed in one of the existing directories?With this move comes a flip in relationship between the desktop code and Calypso itself.
In
wp-desktop
Calypso is a submodule (wp-desktop -> wp-calypso). After the mergewp-desktop
will instead be a submodule of Calypso.One of the immediate impacts of this is that the webpack config in
wp-desktop
no longer resolves correctly.Currently, the
wp-desktop
config makes use ofresolve.modulesDirectories
like so:My concern here is that here we have 4 different directories resolving at a top level that could potentially conflict.
An interesting case is that
calypso/server
andcalypso/client
each have a./boot
directory.wp-desktop/desktop/server/server
refers to aboot
file like so:I may be mistaken but I think it's by luck alone that this resolves as the
calypso/server
file and not that ofcalypso/client
.I think there may be value in being a little more explicit with
import
s/require
s when referencing any 'Calypso' code from within thedesktop
, possibly setting up the webpack config file to enable something like the following instead:This doesn't solve the issue of having multiple directories share the same root-level referencing though but I'll continue to think of a better solution.
For starters though, I'm hoping to at least pull out all but
node_modules
frommodulesDirectories
and instead set the other directories to eitherroot
s oralias
s - I plan to update a PR inwp-desktop
with those changes once tested and working ( Automattic/wp-desktop#272 ).I'd love to hear your thoughts on any of the above points :)
The text was updated successfully, but these errors were encountered: