add temporary hack for getting .mjs builds for node v14 #1266
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 Rust version of Toast works with node v14 esm, and the preact package specifically (but also the others) doesn't have valid esm builds for node.
The custom undocumented build system we're using isn't something I want to touch before we make sure this release and such works as a general approach. So this PR includes a small change to the build script to copy the module-appropriate js file from it's location in the preact package to the needed location, and adds additional metadata to the package.json in the form of the exports keyword. This will ensure that existing callers receive the same code as usual while import callers receive the .mjs code.
This is the smallest change I could make to execute this, but we'll probably want to move away from
r
to something like microbundle, which already supports this use case (as well as our existing ones) and is also well maintained and documented, if we want to pursue modern builds for more packages. (I'm happy to do this work in another PR).