experiment: Frontend - Share v1 UI via coder/m submodule (Approach 1)#4
experiment: Frontend - Share v1 UI via coder/m submodule (Approach 1)#4bryphe-coder wants to merge 2 commits into
Conversation
| @@ -0,0 +1,33 @@ | |||
| declare module "match-sorter" { | |||
There was a problem hiding this comment.
We have a couple of definition files that needed to be picked up to compile the 'v1' modules... If we go with this approach, I'll look for a nicer way to handle this.
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "paths": { | ||
| "@v1/*": [ |
There was a problem hiding this comment.
These paths are important to be able to resolve dependencies correctly for the typescript compiler...
| resolve: { | ||
| extensions: ['.tsx', '.ts', '.js'], | ||
| alias: { | ||
| '@v1': path.resolve(__dirname, '..', 'm'), |
There was a problem hiding this comment.
And these aliases and modules are necessary for webpack (or next, on top of webpack) to pick up the nested modules
|
This is a pretty interesting way to do it. My primary concern is the coupling from v2 -> v1. Ideally it's the other way around from my perspective. |
|
Thanks @kylecarbs ! I'll revisit the approach and focus on a strategy that doesn't need coupling from v2 -> v1, like the one you suggested on Slack - I'll look at pulling in components from v1 (like you've done with the |
This is one possible approach to sharing 'V1' components and styling in the context of an independent 'V2' front-end codebase:
This approach entails:
coder/mas a submodulewebpack.config.jsandtsconfig.jsonthat aliasescoder/mreferencesWith this, we can build a stand-alone front-end app that can still pull from the 'v1' codebase to reference components:
The components still need scaffolding to be instantiated - for example, the Confetti Transition requires a 'setup mode' context and a 'user context', so we have to provide those (just stubbed out):
PROS:
coder/mcoder/mandcoder/coderCONS:
coder/codercontain acoder/msubmodule, which might be the opposite of what is needed for the back-end code.