I've just setup Webpack in a WordPress-theme.
The theme uses Bootstrap, and in that regard, the bootstrap.min.js has previously been loaded like this:
wp_enqueue_script( 'bootstrapjs', get_stylesheet_directory_uri() . '/assets/js/bootstrap.min.js', array( 'jquery' ) );
WordPress has jQuery baked into it, so by specifying jquery as a dependency, this works and everybody is happy.
However, now I'm trying to use Webpack. I'm still getting used to it, - and it was my impression that it's good style to compile as many scripts together into one, to limit the request the server has to make to get all the resources.
So I'm torn... Do I
SOLUTION 1) Not compile Bootstrap.min.js using Webpack.
... And just put that file straight in the assets-folder and enqueue it (bypassing Webpack completely).
Upside: I can just use WordPress' jQuery, so that doesn't need to be loaded twice (which could also cause problems).
Downside: Cluttered file-structure, since some files are loaded through Webpack and some aren't. This will also result in a higher number of files (more server-requests).
SOLUTION 2) Compile Bootstrap.min.js using Webpack. This requires me to import jquery and popper, so I can require the Bootstrap.min.js-file without getting an error.
Upside: Better file structure and fewer files that the server needs to request.
Downside: Jquery needs to be loaded twice (which can be a mess). And that can also result in larger file-sizes.