-
-
Notifications
You must be signed in to change notification settings - Fork 186
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] Allow to define entrypoint in importmap.php #1026
base: 2.x
Are you sure you want to change the base?
Conversation
relate to symfony/symfony#53912 |
@@ -267,8 +268,14 @@ private function updateImportMap(array $importMapEntries): void | |||
$this->io->writeError(sprintf('Updating package <comment>%s</> from <info>%s</> to <info>%s</>.', $name, $version, $versionConstraint)); | |||
} | |||
|
|||
$arguments = []; |
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.
A package with version cannot be an entrypoint... so entrypoints should not be concerned here, no ?
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.
Yeah, i see what you mean.
If i remember correctly, it was to avoid too many if
levels but I can add it inside the following condition
Do we allow bundle to change the public/index.php file? Or to create new webpack configs ? I really find weird that a bundle could install things like this. And a bit dangerous. And still wait for a use case that require to create a entrypoint .... maybe you could describe yours for the package in question ? That really could help me understand the need. |
@@ -147,7 +147,7 @@ private function resolveImportMapPackages($phpPackage): array | |||
} | |||
|
|||
$dependencies = []; | |||
|
|||
$entrypoints = $packageJson->read()['symfony']['entrypoints'] ?? []; |
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.
Took some time to refresh my memory and re-read all this code 😅
So .. nope : this is not related to importmap entrypoints, but to stimulus bundle + controllers.json file. Thus should not be used here :)
Should not be used here
$dependencies[$importMapName] = [ | ||
'path' => $path, | ||
'entrypoint' => \in_array($importMapName, $entrypoints, true), | ||
]; |
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.
By definition, a dependency cannot be an importmap entrypoint :)
Hello 👋
I wanted that one of my package to be able to define an asset as entrypoint inside importmap.php to be allow call
importmap('@mypackage/entry.js')
inside a template of the package.I made a naive modification, not sure if it was the purpose of the
[symfony][entrypoints]
node of the package.json.Maybe it would be fit directly inside the
[symfony][importmap]
node.WDYT ?