In this article, I'll show a simple way to start a webpack project with degit
degit is a tool that lets you take another repository from GitHub and use it to scaffold your project. You can see it being used in serious projects such as SolidJS.
Since I started working on this blog, I created more than 10 repositories with simple applications build with webpack. As I try keeping the code rather minimalistic, in most cases, all the projects end up almost the same. So today, I created a starter project to save me few seconds when starting new demo projects.
$ npx degit how-to-js/webpack-starter npx: installed 1 in 0.671s > cloned how-to-js/webpack-starter#HEAD $ npm install npm notice created a lockfile as package-lock.json. You should commit this file. added 121 packages from 158 contributors and audited 121 packages in 3.164s 17 packages are looking for funding run `npm fund` for details found 0 vulnerabilities $ npm run build > firstname.lastname@example.org build /home/marcin/workspace/github/webpack-starter-demo > webpack asset main.js 22 bytes [compared for emit] [minimized] (name: main) ./src/index.js 23 bytes [built] [code generated] WARNING in configuration The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment. You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/ webpack 5.51.1 compiled with 1 warning in 186 ms
The resulting application does nothing but says hello in the development console.
In this article, I have presented a simple project started for the webpack application.