-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[AssetMapper] Put importmap in polyfill so it can be hosted locally easily #51828
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
[AssetMapper] Put importmap in polyfill so it can be hosted locally easily #51828
Conversation
9e7e935 to
311a2fc
Compare
| public function __construct( | ||
| private readonly ImportMapManager $importMapManager, | ||
| private readonly RemotePackageDownloader $packageDownloader, | ||
| private readonly string $projectDir, |
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.
Is this necessary "just" to render a success message ?
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.
It is... which is kind of lame, but otherwise, I'll be rendering the whole "Downloaded assets into /foo/bar/baz/my-project/assets/vendor"
src/Symfony/Component/AssetMapper/Command/ImportMapRequireCommand.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/AssetMapper/Tests/ImportMap/RemotePackageDownloaderTest.php
Outdated
Show resolved
Hide resolved
5174c83 to
0cc5f9c
Compare
|
UPDATE All good now - here is the flow: A) If the polyfill is set to B) If the user chooses to add So the default behavior is basically identical to now, but with the option to add |
0fd142f to
397a816
Compare
397a816 to
cb02e68
Compare
cb02e68 to
d2014eb
Compare
|
Thank you @weaverryan. |
Note: Built on top of #51786
In #51302, it was asked to allow the polyfill to be an asset mapper path. We could do that, but it would still require the user to "manage" this vendor file locally - i.e. commit it into their repository. So this PR goes a bit further and requires your polyfill to be an item in
importmap.php. That's a bit odd, but because of #51786, it allows the JS package to be downloaded like any other JS package. The item is actually removed from theimportmapbefore it's finally dumped. So the small oddity of having this item inimportmap.phpmakes a really nice DX.Cheers!