Closed WinterSilence closed 1 year ago
Q | A |
---|---|
Is bugfix? | ✔️ |
New feature? | ❌ |
Breaks BC? | ❌ |
Fixed issues |
This could be relevant for some developers (e.g. with asset compressing. Closure compile does not like already compressed files). Could you please add a CHANGELOG entry?
@simialbi in first case, #51 and #52 fix problems with invalid paths in source maps: need keep folder's structure at publishing assets
This change is breaking.
If you use the console asset controller to compress your assets. (https://www.yiiframework.com/doc/api/2.0/yii-console-controllers-assetcontroller) and your configuration bundles
includes:
'yii\bootstrap5\BootstrapAsset',
'yii\bootstrap5\BootstrapPluginAsset',
'yii\bootstrap5\BootstrapIconAsset',
Then you get the following error:
PHP Warning 'yii\base\ErrorException' with message 'file_get_contents(app/frontend/web/assets/c13acc9d/dist/js/bootstrap.bundle.js): failed to open stream: No such file or directory'
Because the default hasher of AssetManager
is only based on the dir both Assets have the same $dstDir
(assets destination directory), since BootstrapAsset was run first it excludes all JS (or vice versa if you include BootstrapPluginAsset and it depends on BootstrapAsset). Then when BootstrapPluginAsset is registered it assumes the directory contains its assets (since it exists) but it does not since only CSS was copied. See: https://github.com/yiisoft/yii2/blob/277be0b8e789573e0e4ba912db298929e46a8737/framework/web/AssetManager.php#L553