Open
Description
We are using https://www.npmjs.com/package/markdown-to-jsx in our project. And import a namespace from it via:
import type { MarkdownToJSX } from 'markdown-to-jsx'`
With "typescript": "5.8.3"
things work as expected.
With "@typescript/native-preview": "^7.0.0-dev.20250522.2"
, there's the following error:
Module '"/Users/.../my-repo/node_modules/markdown-to-jsx/dist/index.cjs"' has no exported member 'MarkdownToJSX'. Did you mean to use 'import MarkdownToJSX from "/Users/.../my-repo/node_modules/markdown-to-jsx/dist/index.cjs"' instead?
import type { MarkdownToJSX } from 'markdown-to-jsx';
Checking markdown-to-jsx
's "exports"
, things look reasonable enough:
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"node": "./dist/index.module.js",
"default": "./dist/index.modern.js"
},
"require": {
"types": "./dist/index.cjs.d.ts",
"default": "./dist/index.cjs"
}
}
},
It looks suspicious that tsgo
tries to resolve to CJS files, and not ESM.
For ref, here's our repo's full TSconfig:
TSconfig
{
"compilerOptions": {
// type checking
"strict": true,
"allowUnusedLabels": false,
"allowUnreachableCode": false,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"noUnusedParameters": true,
"noImplicitThis": true,
"useUnknownInCatchVariables": true,
"noPropertyAccessFromIndexSignature": false,
"noImplicitReturns": false,
"noUncheckedIndexedAccess": false,
"noImplicitAny": false,
// modules
"baseUrl": "./",
"module": "Preserve",
"moduleResolution": "bundler",
"paths": {
"MODULES/*": ["./src/modules/*"],
"UTILS/*": ["./src/utils/*"],
"LEGACY/*": ["./src/LEGACY/*"],
"SRC/*": ["./src/*"]
},
"resolveJsonModule": true,
// emit
"noEmit": true,
// JS support
"allowJs": false,
// interop
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"verbatimModuleSyntax": false,
// language and environment
"target": "es2021",
"lib": ["dom", "dom.iterable", "esnext"],
"jsx": "react-jsx",
// completeness
"skipLibCheck": true
},
"exclude": ["node_modules", "cypress", "coverage", "build"],
"include": [
"./@types/**/*.ts",
"./src/**/*.ts",
"./src/**/*.tsx",
"node_modules/vitest/globals.d.ts",
"./playwright"
]
}
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
filipsobol commentedon May 23, 2025
This might be the same issue as described here: #895 (comment)
See #904.