Tree shaking in Flagpack #46
Replies: 2 comments
-
This implementation has been chosen instead of the earlier attempted methods here: |
Beta Was this translation helpful? Give feedback.
-
Current issues with our approachWith While this worked in testing with a CRA and CNA in a local package, this turned out be a bit more problematic in a live environment. Dynamic imports are relatively new, and don't seem to work well together with requiring SVG's. This seems to be the downfall of both our current A different approachWe have quite a few CLI scripts in our
With this approach we solve a few things.
MeanwhileIn the meantime we should probably revert |
Beta Was this translation helpful? Give feedback.
-
This discussion aims to provide a place for feedback in regards to the planned implementation of Tree shaking in Flagpack.
The problem
Currently Flagpack doesn't support Tree shaking, this is because we load in all the flags to be able to dynamically decided which flag the user needs. This however poses a problem, as in theory the user could need all flags. As such static analysis tools are unable to tree shake the core.
Proposed solution
After carefull consideration, we have come to the following plan of action to implement treeshaking.
So for example the react-flagpack would parse flags as following instead:
Possible issues with this implementation
The following possible issues have been identified, we aim to mitigate these as much as possible.
This is an ongoing process, and is subject to change, and open to feedback.
Beta Was this translation helpful? Give feedback.
All reactions