Skip to content
This repository has been archived by the owner on Oct 24, 2021. It is now read-only.

maxmilton/repro-tsm-native-esm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Repro tsm native esm

Minimal reproducible case for tsm bug. See lukeed/tsm#7.

Instructions

  1. Install dependencies
  2. Run start script e.g., npm start

Result

> node -r tsm index.ts

/home/max/Projects/repro-tsm-native-esm/index.ts:1
import getPort from 'get-port';
                                                                                                                                                                                                                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/max/Projects/repro-tsm-native-esm/node_modules/.pnpm/get-port@6.0.0/node_modules/get-port/index.js from /home/max/Projects/repro-tsm-native-esm/index.ts not supported.
Instead change the require of index.js in /home/max/Projects/repro-tsm-native-esm/index.ts to a dynamic import() which is available in all CommonJS modules.
    at Object.apply (/home/max/Projects/repro-tsm-native-esm/index.ts:1:213)
    at Object.<anonymous> (/home/max/Projects/repro-tsm-native-esm/index.ts:20:34)
    at Module.t._compile (/home/max/Projects/repro-tsm-native-esm/node_modules/.pnpm/tsm@2.1.0/node_modules/tsm/require.js:1:935)
    at Object.loader (/home/max/Projects/repro-tsm-native-esm/node_modules/.pnpm/tsm@2.1.0/node_modules/tsm/require.js:1:948) {
  code: 'ERR_REQUIRE_ESM'
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published