A simplified example of a modern module bundler written in JavaScript
As front-end developers, we spend a lot of time working with tools like Webpack, Browserify, and Parcel.
Understanding how those tools work can help us make better decisions on how we write our code. By understanding how our code turns into a bundle and how that bundle looks like we can also debug it better.
The purpose of this project is to explain how most bundlers work under the hood. It contains a short implementation of a simplified but still reasonably accurate bundler. Along with the code, there are comments explaining what the code is trying to achieve.
Head on to the source code: src/minipack.js.
Start by installing dependencies:
$ yarn install
And then run the script:
$ node src/minipack.js
$ yarn build
To lint:
$ yarn lint
The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes
The Babel parser (previously Babylon) is a JavaScript parser used in Babel.