Description
Description
Let me start with, sorry Ryan for messing around again 😊
When running:
symfony console importmap:require highcharts
I get the following error:
This is mainly just caused by the jsDelivr API and looking at the package they try to give some more info. They mention, for highcharts
specific, to look at the dist
(repo) of the package.
However the highcharts-dist
package is not available and therefor it's (still) not possible to use the command like symfony console importmap:require highcharts-dist
for that.
Long story short
How should in this case highcharts
(or any package which exceeds the limit) be used in combination with asset-mapper
?
- Is there a way?
- If not, should we add support for it or explicitly don't support it as it's basically a problem caused by jsDelivr?
Either way we should add something to the documentation about such a scenario?
Possible approaches
- Even using the
install
jsDelivr snippet and add that in my base template gave me a403
error. Looking at highcharts-dist documentation it would be possible to use their own CDN, but that's not supported inasset-mapper
at the moment.- Should we revert deprecate the
url
option in theImportMapConfigReader
? And somehow add support for this scenario? - Also using a custom 'install 'snippet would gave me errors like
An import map is added after module script load was triggered.
So we should fix this with theimportmap()
function / in theimportmap.php
file.
- Should we revert deprecate the
- Ability to add a custom
PackageResolverInterface
and have a multiple resolvers chain?
I even went rogue trying to have sort of an hybrid asset-mapper/webpack-encore
approach and downloading the highcharts
package with yarn
and trying to map the assets:
framework:
asset_mapper:
paths:
assets/: ''
node_modules/highcharts/css: 'highcharts-css'
node_modules/highcharts/es-modules/Core/Chart: 'highstock-es'
But that gave me a similar error
It may be possible if the code related to the highcharts
implementation was completely handled with webpack-encore
and then bundled and imported with importmap
but didn't try that (yet). It's pretty ugly but if that's the only way...
Example
No response