Skip to content

Simple dual build to highlight tsc compiler differences when using module globals.

Notifications You must be signed in to change notification settings

knightedcodemonkey/tsc-module-globals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The tsc compiler seems to report errors differently when using globals from different module systems (es or commonjs).

This example uses __dirname and meta.import.dirname but only the latter is reported when targeting commonjs via the "type" field in package.json. The __dirname silently passes when targeting es modules, but both produce runtime errors in node.

  • npm i
  • npm run esm (note no compile error but the output causes a runtime error)
  • npm run cjs (note there is a compile error)

About

Simple dual build to highlight tsc compiler differences when using module globals.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published