Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
THIS IS A DRAFT VERSION AND NOT FINALIZED YET!
The code is also not clean or final. I'd like to get the concept working first and only then focus on optimizations and cleanup.
Related PRs
If things get working as expected, we might even reduce the number of
webpack.config
files to one (instead of two that I introduced) and build all the components inside root/lib
folder so we can reuse and pull them in inside bothxp-registration
andxp-api
(in other words there won't be a need to keep separate bundles anymore). We have all the components in one place ready to be pulled in independently OR we can still useall.js
to pull in components in one go like we already do:import { ComponentA, ComponentB } from 'xp-ui'
. This way we support existingxp-api
andxp
imports and allow for flexibility when working withxp-registration
where we expect some components to be lazy loaded.I've changed the
build
NPM script command to run custom node script (/scripts/compile.js
) to bundle index file (so we can still doimport { ComponentA } from 'xp-ui
) and babel-ify individual components so we can pull them in individually from the client apps. I might definitely be missing smth as the final setup doesn't work as it should 🤔 But sharing to keep it visible and so that everyone can try that out locally. It's likely that the way we build individual components should be changed somehow, something should be tuned to make this all work 😛 🤔An alternative to a custom build script (which I find very flexible and a clean way to expose logs into console), I also tried the following command for the
build
script which does pretty much the same thing (keeping it here for the reference only):Here's the structure we generate in
xp-ui
withnpm run build
command:It's assumed that having those files/folders prebuilt and babelified we could reference them from the client apps like
xp-registration
, so that the import statement looks like that:On the client side (in
xp-registration
repo), we'll need to runnpm I
to install the correct test version ofxp-ui
and to auto-generate/lib
folder. Here's how installednode_modules/xp-ui/
looks like after installingxp-ui
:Imports inside
xp-registration
have also been updated to reflect the new reference path.Current issues:
npm run build
inxp-registration
fails with: