-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Allow importmap overrides in shim mode with option #257
Allow importmap overrides in shim mode with option #257
Conversation
Total additional footprint is 7 bytes.
Used for footprint command, but was being loaded as transitive dependency previously.
Had to make a separate test suite, as I couldn't figure out a way to make this test coexist with the existing shim suite, since it required a different override option from the other tests. Open to ideas!
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.
Looks great, thanks for your work on this!
With the latest changes we're only 2 bytes higher at 9162 now! I guess refactoring out the resolve functions must have saved enough bytes to make up for everything else, somehow. |
Thanks for the quick turnaround on this one - footprint is great! Will release soon, just hoping to get #255 fix in as well. |
As discussed in #254, this PR adds a
override
boolean option to allow overriding of existing import map entries in shim mode, defaulting to false to preserve current behavior. Overall increase in footprint is 7 bytes to 9167 according to thenpm run footprint
command.A few hoops I had to jump through:
Depending on ./config.js in ./common.js introduced a circular dependency, which caused some weird issues in tests. So I ended up refactoring the noop function into its own module to untangle it. I also tried inlining the noop function everywhere, but it ended up making the bundle larger than using a separate module.
For testing, I ended up adding a separate module for this option because I couldn't figure out a way to make the test coexist in the same module without conflicting with the existing importmap overrides tests, which require this option to be off. Open to alternatives!