A simple module bundler implemented with javascript and babel.
In this repo, we implement a very simple module bundler, whose functionality is similar to webpack. Several NPM modules are very important in the whole building process.
- babylon module, currently known as @babel/parser, is used to convert es6 new syntax to AST(Abstract Syntax Tree) tree structure.[ acornjs - https://github.com/acornjs/acorn ]
- babel-traverse module, currently known as @babel/traverse, is used to analyze the module dependencies( namely imported modules ) in es6 code.
transformFromAst
method coming from babel-core, currently known as @babel/core, is used to transforms AST tree structure to es5 code.
Finally, we need to put the generated code into a module wrapper. A simple wrapper looks like the code here.