Skip to content

JonasDoe/typescript-esm-issue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demonstration of the Transpilation Failure

Requirements

  • Create a CommonJS project with Node22, so --experimental-require-module is supported.
  • Import the default export of an ESM dependency
  • Enable esModuleInterop (otherwise it will work)
  • Transpilation will create an object like {"default": {"default": ...}}

To Reproduce

npm run js

The script will fail with TypeError: oidc_provider_1.default is not a constructor. Head over to the generated index.js and to the faulty line:

console.log('Created new Provider:', new oidc_provider_1.default('http://example.tld'));

Replace it with:

console.log('Created new Provider:', new oidc_provider_1.default.default('http://example.tld'));

Now, it's working and will log the Provider object.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published