How to handle project assets with NPM together with SonataAdminBundle?

Viewed 74

Since version 4.x of SonataAdminBundle all assets are handled using NPM and WebPack. In my project I also have some assets and JS libraries and I'm also using NPM and WebPack. What should I do in this case? For example, SonataAdminBundle uses libraries such as jQuery, Bootstrap, but I also use them (in my package.json).

One of the ideas that came to my mind is to import the main "app.js" file (vendor/sonata-project/admin-bundle/assets/js/app.js) from SonataAdminBundle which contains all the required components to run to my main "app.js" file and then import my other additional libraries and assets. Next, I would then copy all the dependencies from the SonataAdminBundle package.json file (vendor/sonata-project/admin-bundle/package.json) and paste it into my package.json file.

I am not sure if this approach is correct.

The downside of this solution would be to compare the package.json files after each update of the SonataAdminBundle library and apply any changes.

Do you have other ideas to solve this problem?

0 Answers
Related