Introducing how to create a module bundler.
You can see output codes here.
| Implementation Contents | Output Code |
|---|---|
CJS (require/exports/module.exports) |
cjs/simple |
| circular dependency (CJS/ESM) | cjs/circularDependency |
| node_modules with CJS | cjs/node-modules |
| ESM | esm/simple, esm/complication |
import ImportDeclaration |
esm/import |
default import/export (ImportDefaultSpecifier,ExportDefaultDeclaration) |
esm/default |
specifier import/export(ImportSpecifier, ExportNamedDeclaration) |
esm/specifier |
namespace specifier import (ImportNamespaceSpecifier) |
esm/namespaceSpecifier |
| node_modules with ESM | esm/node-modules |
| interop between CJS and ESM | common/interop |
$ npm i
$ npm test
$ cd tests/output # and you can see the output code