René's URL Explorer Experiment


Title: TypeScript cannot emit valid ES modules due to file extension issue · Issue #42151 · microsoft/TypeScript · GitHub

Open Graph Title: TypeScript cannot emit valid ES modules due to file extension issue · Issue #42151 · microsoft/TypeScript

X Title: TypeScript cannot emit valid ES modules due to file extension issue · Issue #42151 · microsoft/TypeScript

Description: Bug Report This report is based on the problem covered in #28288 and #16577, but intends to emphasize the fact that this explicitly precludes TS from emitting valid ECMAScript modules. Issue Because TS imports do not allow file extension...

Open Graph Description: Bug Report This report is based on the problem covered in #28288 and #16577, but intends to emphasize the fact that this explicitly precludes TS from emitting valid ECMAScript modules. Issue Becaus...

X Description: Bug Report This report is based on the problem covered in #28288 and #16577, but intends to emphasize the fact that this explicitly precludes TS from emitting valid ECMAScript modules. Issue Becaus...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/42151

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeScript cannot emit valid ES modules due to file extension issue","articleBody":"# Bug Report\r\nThis report is based on the problem covered in #28288 and #16577, but intends to emphasize the fact that this explicitly precludes TS from emitting valid ECMAScript modules.\r\n\r\n## Issue\r\nBecause TS imports do not allow file extensions, but imports in emitted ES modules are _not_ resolved to their relevant file extensions (`import ... from './myModule'` vs. `import ... from './myModule.js'`), this output is unusable unless transpiled *again* with Rollup + Babel or a similar toolkit, no matter how much active care is taken while authoring source code. Executing emitted modules will always throw `ERR_MODULE_NOT_FOUND` because these sources are not rewritten.\r\n\r\nSwitching to `\"module\": \"commonjs\"` is not a valid suggestion in this case, as the goal is to get valid ESM output.\r\n\r\n### ⏯ Playground Link\r\n\r\n\u003c!--\r\n  A link to a TypeScript Playground \"Share\" link which shows this behavior\r\n\r\n  The TypeScript Workbench can be used for more complex setups, try\r\n  https://www.typescriptlang.org/dev/bug-workbench/\r\n\r\n  As a last resort, you can link to a repo, but these will be slower for us to investigate.\r\n-->\r\nUse `yarn test`: https://repl.it/@christiantjl/TSImportFileExtensions\r\n\r\n\r\n### 💻 Code\r\n\r\n#### `tsconfig.json`\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"outDir\": \"build/\",\r\n    \r\n    \"target\": \"esnext\",\r\n    \"module\": \"esnext\",\r\n\r\n    \"moduleResolution\": \"node\",\r\n    \"esModuleInterop\": true\r\n  }\r\n}\r\n```\r\n\r\n#### `index.ts`\r\n```typescript\r\nimport { test } from './importMe';\r\nconsole.log(test); \r\n```\r\n\r\n#### `build/index.js`\r\n```javascript\r\nimport { test } from './importMe';\r\nconsole.log(test);\r\n```\r\n\r\n### 🙁 Actual behavior\r\nThe `import { test } from './importMe'` statement is not modified.\r\n\r\n### 🙂 Expected behavior\r\n`build/index.js` should contain:\r\n```javascript\r\nimport { test } from './importMe.js';\r\nconsole.log(test);\r\n```\r\n\r\n\r\n","author":{"url":"https://github.com/ctjlewis","@type":"Person","name":"ctjlewis"},"datePublished":"2020-12-30T00:30:14Z","url":"https://github.com/microsoft/TypeScript/issues/42151"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:38f0dc03-ce56-ae34-158c-87665b3f8998
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE0C:21BD98:4CF6EC:613795:6B010C22
html-safe-nonce5f5e0aa29ebcb475b6fa3418f9f5d329511b3136eac12dd452710177e80044cd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTBDOjIxQkQ5ODo0Q0Y2RUM6NjEzNzk1OjZCMDEwQzIyIiwidmlzaXRvcl9pZCI6IjkwNTkyNjczODU1ODM3OTkzMzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0e5817edbd4c68eeb4dfb7a66ab46edaaf67cacca45618a4cd37eac295a49336
hovercard-subject-tagissue:776143967
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/42151/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4a16006a4616fc7331ab25af0e7643f7ab1a7cd8b4f8ff2714f8dcb188bfe9ab/microsoft/TypeScript/issues/42151
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4a16006a4616fc7331ab25af0e7643f7ab1a7cd8b4f8ff2714f8dcb188bfe9ab/microsoft/TypeScript/issues/42151
og:image:altBug Report This report is based on the problem covered in #28288 and #16577, but intends to emphasize the fact that this explicitly precludes TS from emitting valid ECMAScript modules. Issue Becaus...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamectjlewis
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/42151#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F42151
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F42151
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/42151
Reloadhttps://github.com/microsoft/TypeScript/issues/42151
Reloadhttps://github.com/microsoft/TypeScript/issues/42151
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests310 (310)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/42151
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/42151
#42184https://github.com/microsoft/TypeScript/pull/42184
TypeScript cannot emit valid ES modules due to file extension issuehttps://github.com/microsoft/TypeScript/issues/42151#top
#42184https://github.com/microsoft/TypeScript/pull/42184
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
https://github.com/ctjlewis
Lewis (ctjlewis)https://github.com/ctjlewis
on Dec 30, 2020https://github.com/microsoft/TypeScript/issues/42151#issue-776143967
#28288https://github.com/microsoft/TypeScript/issues/28288
#16577https://github.com/microsoft/TypeScript/issues/16577
https://repl.it/@christiantjl/TSImportFileExtensionshttps://repl.it/@christiantjl/TSImportFileExtensions
Nexthttps://github.com/microsoft/TypeScript/issues/42151?timeline_page=1
https://github.com/andrewbranch
Andrew Branch (andrewbranch)https://github.com/andrewbranch
on Dec 30, 2020https://github.com/microsoft/TypeScript/issues/42151#issuecomment-752744796
Andrew Branch (andrewbranch)https://github.com/andrewbranch
QuestionAn issue which isn't directly actionable in codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Question%22
on Dec 30, 2020https://github.com/microsoft/TypeScript/issues/42151#event-4158260695
https://github.com/RGFTheCoder
Ramon (RGFTheCoder)https://github.com/RGFTheCoder
on Jan 2, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-753490929
https://github.com/ctjlewis
Lewis (ctjlewis)https://github.com/ctjlewis
on Jan 2, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-753506506
Ramon (@RGFTheCoder)https://github.com/RGFTheCoder
Robert Knight (robertknight)https://github.com/robertknight
on Jan 2, 2021https://github.com/microsoft/TypeScript/issues/42151#event-4161903885
Switch package to use ES modules everywherehttps://github.com/robertknight/ureact/commit/55c4b8f7b7f8088a1316aa86ed6560934ff46390
55c4b8fhttps://github.com/robertknight/ureact/commit/55c4b8f7b7f8088a1316aa86ed6560934ff46390
Switch package to use ES modules everywherehttps://github.com/robertknight/ureact/commit/ca80e4d4ae6dd82f302f4d2703935b68c91c0d70
ca80e4dhttps://github.com/robertknight/ureact/commit/ca80e4d4ae6dd82f302f4d2703935b68c91c0d70
https://github.com/andrewbranch
Andrew Branch (andrewbranch)https://github.com/andrewbranch
on Jan 4, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-754152319
Ramon (@RGFTheCoder)https://github.com/RGFTheCoder
https://user-images.githubusercontent.com/3277153/103567409-9fdc7780-4e78-11eb-95d7-b1d82fa02d87.png
#16577https://github.com/microsoft/TypeScript/issues/16577
Andrew Branch (andrewbranch)https://github.com/andrewbranch
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
QuestionAn issue which isn't directly actionable in codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Question%22
on Jan 4, 2021https://github.com/microsoft/TypeScript/issues/42151#event-4166260903
Andrew Branch (andrewbranch)https://github.com/andrewbranch
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#42184https://github.com/microsoft/TypeScript/pull/42184
on Jan 5, 2021https://github.com/microsoft/TypeScript/issues/42151#event-4171488083
https://github.com/richardkazuomiller
Ricky Miller (richardkazuomiller)https://github.com/richardkazuomiller
on Aug 14, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-898818284
https://github.com/ctjlewis
Lewis (ctjlewis)https://github.com/ctjlewis
on Aug 14, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-898903665
Ricky Miller (@richardkazuomiller)https://github.com/richardkazuomiller
https://github.com/ctjlewis
Lewis (ctjlewis)https://github.com/ctjlewis
on Sep 6, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-913716597
Andrew Branch (@andrewbranch)https://github.com/andrewbranch
https://github.com/tszip/rollup-config/blob/master/src/plugins/resolveImports/index.tshttps://github.com/tszip/rollup-config/blob/master/src/plugins/resolveImports/index.ts
#42184https://github.com/microsoft/TypeScript/pull/42184
https://github.com/andrewbranch
Andrew Branch (andrewbranch)https://github.com/andrewbranch
on Sep 7, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-914472944
#16577https://github.com/microsoft/TypeScript/issues/16577
#44501https://github.com/microsoft/TypeScript/pull/44501
#15479 (comment)https://github.com/microsoft/TypeScript/issues/15479#issuecomment-300240856
#16577 (comment)https://github.com/microsoft/TypeScript/issues/16577#issuecomment-754941937
#26722 (comment)https://github.com/microsoft/TypeScript/issues/26722#issuecomment-580975983
#33588https://github.com/microsoft/TypeScript/issues/33588
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 18, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-922172294
Andrew Branch (@andrewbranch)https://github.com/andrewbranch
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-928980128
Orta Therox (@orta)https://github.com/orta
https://github.com/richardkazuomiller
Ricky Miller (richardkazuomiller)https://github.com/richardkazuomiller
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929003209
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929022861
https://user-images.githubusercontent.com/1706381/135062362-10bbe44f-556f-40c3-927f-9bd0c1dadb79.png
https://github.com/richardkazuomiller
Ricky Miller (richardkazuomiller)https://github.com/richardkazuomiller
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929064951
https://github.com/orta
Orta Therox (orta)https://github.com/orta
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929071117
#42151 (comment)https://github.com/microsoft/TypeScript/issues/42151#issuecomment-914472944
#16577 (comment)https://github.com/microsoft/TypeScript/issues/16577#issuecomment-754941937
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929072922
https://github.com/orta
Orta Therox (orta)https://github.com/orta
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929109547
via a WeakMaphttps://www.staging-typescript.org/play?ts=3.8.3&q=92#example/private-class-fields
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929150602
https://github.com/orta
Orta Therox (orta)https://github.com/orta
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929222953
https://github.com/thetutlage
Harminder Virk (thetutlage)https://github.com/thetutlage
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929224730
https://github.com/richardkazuomiller
Ricky Miller (richardkazuomiller)https://github.com/richardkazuomiller
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929313949
documentation for moduleshttps://www.typescriptlang.org/docs/handbook/modules.html#native-ecmascript-2015-modules-simplemodulejs
https://github.com/orta
Orta Therox (orta)https://github.com/orta
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929319350
https://github.com/ctjlewis
Lewis (ctjlewis)https://github.com/ctjlewis
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929329681
via a WeakMaphttps://www.staging-typescript.org/play?ts=3.8.3&q=92#example/private-class-fields
microsofthttps://github.com/microsoft
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#event-5375042143
https://github.com/andrewbranch
Andrew Branch (andrewbranch)https://github.com/andrewbranch
on Sep 28, 2021https://github.com/microsoft/TypeScript/issues/42151#issuecomment-929391408
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/42151
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/42151
DuplicateAn existing issue was already createdhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Duplicate%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.