Skip to content
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] JavaScriptImportPathCompiler::compile(): returns null in some cases #54096

Closed
tacman opened this issue Feb 27, 2024 · 5 comments
Closed

Comments

@tacman
Copy link
Contributor

tacman commented Feb 27, 2024

Symfony version(s) affected

7.0.4

Description

Something changed between 6.4.3 and 6.4.4 (and 7.0.3 and 7.0.4).

In the example below, assetmapper is locked to 7.0.3, but updating causes the problem.

How to reproduce

git clone git@github.com:survos-sites/dt-demo && cd dt-demo
composer install
symfony server:start -d 
symfony open:local

All is well. Update to

composer require symfony/asset-mapper:^7.0.4
bin/console importmap:update
# failure!
symfony open:local
bin/console importmap:install
bin/console importmap:update
symfony open:local

Possible Solution

No response

Additional Context

No response

@tacman
Copy link
Contributor Author

tacman commented Feb 27, 2024

I can't tell if it's related to the underlying datatables.net libraries being updated, I've opened an issue there as well:

https://datatables.net/forums/discussion/78313/2-0-error-with-importmaps#latest

You'll see that error with the importmap:update command, it fails right away.

@tacman
Copy link
Contributor Author

tacman commented Feb 28, 2024

It appears that a file in importmap is not longer available. From the library author:

datatables.net-dt/css/jquery.dataTables.min.css

This part at least is wrong (it resolves to a 404 later in the message that you quote.

The correct file is now named datatables.net-dt/css/dataTables.dataTables.min.css. Same file, different name.

@fpucci-git
Copy link

fpucci-git commented Feb 28, 2024

Since upgrading to Symfony 7.0.4, our dev site no longer loads css and js

If I try to put the js path present in the dev HTML, the error is as follows

Symfony\Component\AssetMapper\Compiler\JavaScriptImportPathCompiler::compile(): Return value must be of type string, null returned

in vendor/symfony/asset-mapper/Compiler/JavaScriptImportPathCompiler.php (line 119)
in vendor/symfony/asset-mapper/AssetMapperCompiler.php -> compile (line 40)
in vendor/symfony/asset-mapper/Factory/MappedAssetFactory.php -> compile (line 108)
in vendor/symfony/asset-mapper/Factory/MappedAssetFactory.php -> compileContent (line 49)
in vendor/symfony/asset-mapper/Factory/CachedMappedAssetFactory.php -> createMappedAsset (line 42)
in vendor/symfony/asset-mapper/AssetMapper.php -> createMappedAsset (line 41)
in vendor/symfony/asset-mapper/AssetMapper.php -> getAsset (line 47)
in vendor/symfony/asset-mapper/AssetMapperDevServerSubscriber.php -> allAssets (line 193)
in vendor/symfony/asset-mapper/AssetMapperDevServerSubscriber.php -> findAssetFromCache (line 127)
in vendor/symfony/event-dispatcher/Debug/WrappedListener.php -> onKernelRequest (line 116)
in vendor/symfony/event-dispatcher/EventDispatcher.php -> __invoke (line 206)
in vendor/symfony/event-dispatcher/EventDispatcher.php -> callListeners (line 56)
in vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php -> dispatch (line 127)
in vendor/symfony/http-kernel/HttpKernel.php -> dispatch (line 154)
in vendor/symfony/http-kernel/HttpKernel.php -> handleRaw (line 76)
in vendor/symfony/http-kernel/Kernel.php -> handle (line 185)
in vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php -> handle (line 35)
in vendor/autoload_runtime.php -> run (line 29)
require_once('/srv/ticket/dev1/vendor/autoload_runtime.php') in public/index.php (line 5)

<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

@fracsi
Copy link
Contributor

fracsi commented Feb 28, 2024

Possible duplicate of #54078

@tacman
Copy link
Contributor Author

tacman commented Feb 28, 2024

Closed in favor of #54078

@tacman tacman closed this as completed Feb 28, 2024
@xabbuh xabbuh closed this as not planned Won't fix, can't repro, duplicate, stale Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants