Skip to content

Commit 64b4110

Browse files
weaverryanfabpot
authored andcommitted
[AssetMapper] Put importmap in polyfill so it can be hosted locally easily
1 parent 5fe8d55 commit 64b4110

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CHANGELOG
3131
* Deprecate the `framework.asset_mapper.provider` config option
3232
* Add `--exclude` option to the `cache:pool:clear` command
3333
* Add parameters deprecations to the output of `debug:container` command
34+
* Change `framework.asset_mapper.importmap_polyfill` from a URL to the name of an item in the importmap
3435

3536
6.3
3637
---

DependencyInjection/Configuration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,8 @@ private function addAssetMapperSection(ArrayNodeDefinition $rootNode, callable $
924924
->defaultValue('%kernel.project_dir%/importmap.php')
925925
->end()
926926
->scalarNode('importmap_polyfill')
927-
->info('URL of the ES Module Polyfill to use, false to disable. Defaults to using a CDN URL.')
928-
->defaultValue(null)
927+
->info('The importmap name that will be used to load the polyfill. Set to false to disable.')
928+
->defaultValue('es-module-shims')
929929
->end()
930930
->arrayNode('importmap_script_attributes')
931931
->info('Key-value pair of attributes to add to script tags output for the importmap.')

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
use Symfony\Component\Asset\PackageInterface;
3434
use Symfony\Component\AssetMapper\AssetMapper;
3535
use Symfony\Component\AssetMapper\Compiler\AssetCompilerInterface;
36-
use Symfony\Component\AssetMapper\ImportMap\ImportMapManager;
3736
use Symfony\Component\BrowserKit\AbstractBrowser;
3837
use Symfony\Component\Cache\Adapter\AdapterInterface;
3938
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -1378,7 +1377,7 @@ private function registerAssetMapperConfiguration(array $config, ContainerBuilde
13781377

13791378
$container
13801379
->getDefinition('asset_mapper.importmap.renderer')
1381-
->replaceArgument(3, $config['importmap_polyfill'] ?? ImportMapManager::POLYFILL_URL)
1380+
->replaceArgument(3, $config['importmap_polyfill'])
13821381
->replaceArgument(4, $config['importmap_script_attributes'])
13831382
;
13841383
}

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function testAssetMapperCanBeEnabled()
132132
'missing_import_mode' => 'warn',
133133
'extensions' => [],
134134
'importmap_path' => '%kernel.project_dir%/importmap.php',
135-
'importmap_polyfill' => null,
135+
'importmap_polyfill' => 'es-module-shims',
136136
'vendor_dir' => '%kernel.project_dir%/assets/vendor',
137137
'importmap_script_attributes' => [],
138138
];
@@ -668,7 +668,7 @@ protected static function getBundleDefaultConfig()
668668
'missing_import_mode' => 'warn',
669669
'extensions' => [],
670670
'importmap_path' => '%kernel.project_dir%/importmap.php',
671-
'importmap_polyfill' => null,
671+
'importmap_polyfill' => 'es-module-shims',
672672
'vendor_dir' => '%kernel.project_dir%/assets/vendor',
673673
'importmap_script_attributes' => [],
674674
],

0 commit comments

Comments
 (0)