Skip to content

dario-piotrowicz/cjs-module-lexer-reexports-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cjs-module-lexer-reexports-repro

This repo simply shows the fact that cjs-module-lexer can produce unhelpful reexport results.

Specifically, the lexer resets the reexport set causing only the last instance of module.exports = require(...) to be considered.

For example parsing the below code:

if (true) {
  module.exports = require("./a.cjs");
} else {
  module.exports = require("./b.cjs");
}

yields { exports: [], reexports: [ './b.cjs' ] }, completely loosing the information that the module is also trying to re-export from './a.cjs'

Reproduction steps

npm i
npm start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published