Webpack is only use for development, then just intall like development dependence
npm i webpack webpack-cli -D
npx webpack --mode development
npx webpack --mode production
For use moderm javascript
npm i babel-loader @babel/core @babel/preset-env @babel/plugin-transform-runtime -D
For use HTML files
npm i html-webpack-plugin -D
For use HTML files
npm i mini-css-extract-plugin css-loader -D
npm i copy-webpack-plugin -D
npm i url-loader file-loader -D
npm i terser-webpack-plugin css-minimizer-webpack-plugin -D
npm i dotenv-webpack -D
npm i clean-webpack-plugin -D