A simple js bundler with no config but the main file as a unique argument, works with commonjs and ES modules. Totally commonjs complaint (see doc). It also supports the ES modules syntax (pre 2020), a good description of them is done here.
- It resolves the DFS three of requires dependencies by using the Babel parser and the Babel translator.
- It overrides the
exports
attribute and therequire
method for each file and it creates a unique scope for each of them. - Concat all the modules!
- Execute the main one!
- ???
- Profit
It only accepts a main file:
// using the main file directly
npm start ../other-things/my-file-with-requires.js
// or...
npm start --main='../other-things/my-file-with-requires.js'
By default, the generated file is stored in dist/output.js
, but you could
modify it by using the --output
argument:
npm start ../other-things/my-file-with-requires.js --output='./other-output-name.js'
This command compares the bundler output against the node.js output without concatenating the files:
npm test