establish async dynamic import logic ✅ #542
Merged
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.
The issue
When using ARCtrl in the browser with vite bundler you get error messages like such on bundling:
This error originates from the following code:
This transpiles to a hard import in js. Which produces the error.
The solution
dynamic imports in ndoe environment:
This syntax only imports the relevant function in node environment but produces a async function.
i established an fsharp emit, that is able to reproduce this syntax interopping with f# function syntax.
Because dynamic imports must be done in an async function i cannot use this syntax for the path functions above as they are not async.
@HLWeil can we make these functions promises or find another workaround? Would love to get your input on this before making system wide changes.
We could:
TODO
add a test react project which uses local build output for arctrl and try building it with CI.
-> will do this as soon as it builds once successfully
streamline bundle process using vite lib mode