forked from scala-cli/scala-js-cli
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support remapping imports at link time #47
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
armanbilge
reviewed
Jan 24, 2024
Gedochao
approved these changes
Jan 29, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, commented on nitpicks
Gedochao
changed the title
Import map fro scala-js
Support remapping imports at link time
Jan 29, 2024
lefou
added a commit
to com-lihaoyi/mill
that referenced
this pull request
May 16, 2024
# Motivation I'm really enjoying frontend scala, without needing to configure an entire node / npm environment. The capability to use the JS ecosystem without a bundler, is the "build primitive", that enables this. Here's a longer discussion of the motivation VirtusLab/scala-cli#1968 (comment) # Implementation arman added this to SBT here and published a library that does the heavy lifting. https://github.com/armanbilge/scalajs-importmap I followed this up in scala-cli ... VirtusLab/scala-js-cli#47 ... and am really enjoying this in the small. My larger projects are in mill though (thanks :-)!). Hence... this PR... which seeks to integrate the capability into mill. I wanted to do it in a plugin - but I couldn't see how as the call to the linker is in a private scope - so I've put it up for mill itself. I would expect this as is to pass CI with the new test. Very open to feedback. If accepted, it would be my first contribution to mill ... I'd be a little surprised if I got everything right straight out the gate - a plugin may indeed be preferable if I have not correctly understood the constraints. Pull request: #3109 --------- Co-authored-by: Tobias Roeser <le.petit.fou@web.de> Co-authored-by: Lorenzo Gabriele <lorenzolespaul@gmail.com> Co-authored-by: Romain Gilles <58700468+romain-gilles-ultra@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 adds the ability to remap imports at link time.
The extra test checks validation of the new flag.
The final output in the new test is the happy path. Hosting the "index.html" file it puts out it in a browser automatically resolves the import and successufully prints to the console (we don't test this, only that the import is correctly remapped int he JS file).
The motivation for the PR is that it would appear to have the potential to sweep away parts of the existing (complicated) toolchain for certain scala-js use cases.