I have installed multiple JS libraries with npm and I trying to use them in Symfony views.
<script src="{{ asset('path/to/js.js') }}"></script>
Do I have to install node modules in web directory ? Is it a good practice ?
What's the best way to achieve that ?
I would suggest using Gulp to compile your assets into minified JS/CSS files. It can installed via npm, run from command line and good documentation exists including specifically how to gulp npm installed files.
Here's a sample of my Gulpfile so you can see how to gulp npm files: