Require is not defind

in the process of learning webpack packaging, other js files are introduced with require in main.js, then the service is started with webpack-dev-server , and an error is reported after opening it

.

webpack.config.js is configured as follows:

clipboard.png

package.json:

clipboard.png
:

clipboard.png
main.js:


lodash.js:


index.html:


npm run dev:

clipboard.png


there is no loader
and HtmlWebpackPlugin needs to be associated with your html


? the modular writing of main.js is for node to execute. Do you expect browsers to recognize require


html js should choose output
instead of entry

?
Menu