In Symfony version 6.4 for using css and javascript is deault use symfony/asset-mapper. But in my application I try use Webpack Encore instead asset-mapper but in javasctipt console i see error
Failed to load module script: Expected a JavaScript module
How I completely disable asset-mapper or completely remove and use Webpack Encore?
Usually it's not more than:
composer remove symfony/asset-mapper.and then:
composer require symfony/webpack-encore-bundleFlex takes care of creating and deleting all the necessary files, and update the necessary templates.
I'm able to do this:
perfectly fine (I just copy-pasted the above on the terminal and ran it without issues).
The only I found to need doing after completing these steps is to remove
assets/vendor. The mere existence of this directory and its contents shouldn't impact negatively your webpack-encore application, but they are not needed/used if you are not using the Asset Mapper component.The two packages are mutually incompatible. If you install webpack-encore-bundle on top of a project that already includes asset-mapper, and then remove one of the two, the recipes may trip themselves, because they handle overlapping concerns, and leave you with a bit of a mess.