When installing both symfony/webapp-pack and symfony/webpack-encore-bundle simultaneously, the resulting assets/bootstrap.js file is corrupt:
import { startStimulusApp } from '@symfony/stimulus-bundle';
const app = startStimulusApp();
import { startStimulusApp } from '@symfony/stimulus-bridge';
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.[jt]sx?$/
));
// register any custom, 3rd party controllers here
// app.register('some_controller_name', SomeImportedController);
Attempting to compile that yields an error:
Syntax Error: Identifier 'startStimulusApp' has already been declared. (4:9)
2 |
3 | const app = startStimulusApp();
> 4 | import { startStimulusApp } from '@symfony/stimulus-bridge';
This should not happen in the first place given that
symfony/stimulus-bundle/2.13/manifest.json carries a conflict entry for symfony/webpack-encore-bundle <=2.0
the installed versions are 2.17.0 for stimulus-bundle and 2.1.1 for webpack-encore-bundle
only the 1.9 recipe for webpack-encore-bundle actually contains bootstrap.js (symfony/webpack-encore-bundle/1.9/assets/bootstrap.js) whereas the 2.0 recipe does not - but why is the 1.9 recipe then executed?
It should be noted that installing the webapp pack first and then installing webpack-encore-bundle directly afterwards works, I assume that something in the Composer interface is broken and doesn't recognize that both bundles are being installed?
Possibly it's also related to this issue, where stimulus got (finally) removed - but again, that shouldn't be the case since webpack-encore-bundle is clearly the newer version that shouldn't ship with stimulus?
Composer version 2.7.4 2024-04-22 21:17:03
PHP version 8.3.6 (/opt/local/bin/php83)
Create an empty skeleton project: composer create-project symfony/skeleton:"7.0.*" my_project_directory
Install both the webapp pack and webpack-encore-bundle at the same time: cd my_project_directory && composer require symfony/webapp-pack symfony/webpack-encore-bundle
When installing both
symfony/webapp-pack
andsymfony/webpack-encore-bundle
simultaneously, the resultingassets/bootstrap.js
file is corrupt:Attempting to compile that yields an error:
This should not happen in the first place given that
symfony/stimulus-bundle/2.13/manifest.json
carries aconflict
entry forsymfony/webpack-encore-bundle <=2.0
It should be noted that installing the webapp pack first and then installing webpack-encore-bundle directly afterwards works, I assume that something in the Composer interface is broken and doesn't recognize that both bundles are being installed?
Possibly it's also related to this issue, where stimulus got (finally) removed - but again, that shouldn't be the case since webpack-encore-bundle is clearly the newer version that shouldn't ship with stimulus?
Logs from composer require
Reproduce
Environment:
composer create-project symfony/skeleton:"7.0.*" my_project_directory
cd my_project_directory && composer require symfony/webapp-pack symfony/webpack-encore-bundle
cat assets/bootstrap.js