As for webpack to collect all js files into one and beneficiality them?

In webpack 3 to collect all js files into one and beneficiality them?
webpack config

const path = require("path");

module.exports = {
 entry: {
 custom: './web/j/custom.js',
 lity: './web/j/lity.js'
},
 output: {
 filename: './bundle.js',
 library: 'myApp'
}
};

The following error message:
ERROR in ./web/j/lity.js
Module not found: Error: Can't resolve 'jquery' in 'path/web/j'
@ ./web/j/lity.js 3:8-5:10
June 5th 19 at 21:52
1 answer
June 5th 19 at 21:54
Solution
npm i jquery

and in the file
import jquery from 'jquery'
const jquery = require ('jquery') - arthur.Volkman commented on June 5th 19 at 21:57
however, we got the following error

ERROR in custom chunk [entry]
./bundle.js
Conflict: emit Multiple assets to the same filename ./bundle.js - arthur.Volkman commented on June 5th 19 at 22:00
you are trying custom.js and lity.js packaging bundle.js. Ie first one source there, and then a second source at the same name. Webpack refuses to overwrite your previous work.
To combine the files do import one inside the other. To have one entry.

And multiple bundles have to do with the filename: '[name].bundle.js' something, I'm not sure need to look. - Willard_Jerde67 commented on June 5th 19 at 22:03

Find more questions by tags JavaScriptWebpack