René's URL Explorer Experiment


Title: Error when trying to use dynamic import with module: "es2015" · Issue #16675 · microsoft/TypeScript · GitHub

Open Graph Title: Error when trying to use dynamic import with module: "es2015" · Issue #16675 · microsoft/TypeScript

X Title: Error when trying to use dynamic import with module: "es2015" · Issue #16675 · microsoft/TypeScript

Description: TypeScript Version: 2.4.0 Code import('./utils') .then(({ sum }) => { console.log(sum(1, 2)) }) .catch(console.error) tsconfig.json (short version) { "compilerOptions": { "moduleResolution": "node", "module": "es2015" } } Expected behavi...

Open Graph Description: TypeScript Version: 2.4.0 Code import('./utils') .then(({ sum }) => { console.log(sum(1, 2)) }) .catch(console.error) tsconfig.json (short version) { "compilerOptions": { "moduleResolution": "node"...

X Description: TypeScript Version: 2.4.0 Code import('./utils') .then(({ sum }) => { console.log(sum(1, 2)) }) .catch(console.error) tsconfig.json (short version) { "compilerOptions": { "...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error when trying to use dynamic import with module: \"es2015\"","articleBody":"**TypeScript Version:**  2.4.0\r\n\r\n**Code**\r\n\r\n```ts\r\nimport('./utils')\r\n  .then(({ sum }) => {\r\n    console.log(sum(1, 2))\r\n  })\r\n  .catch(console.error)\r\n```\r\n**tsconfig.json (short version)**\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"moduleResolution\": \"node\",\r\n    \"module\": \"es2015\"\r\n  }\r\n}\r\n```\r\n\r\n\r\n\r\n**Expected behavior:**\r\nNo errors\r\n\r\n**Actual behavior:**\r\n`Dynamic import cannot be used when targeting ECMAScript 2015 modules.` with non-obvious reasons why.\r\n\r\n[Example repository](https://github.com/Nitive/typescript-dynamic-import)\r\n\r\n---\r\n\r\nI get error `Dynamic import cannot be used when targeting ECMAScript 2015 modules.`\r\nwhen I try to use dynamic import inside typescript project with `\"module\": \"es2015\"`\r\nin configuration. The error message makes it clear that I can't use `import()` with\r\nes modules but it doesn't make sense because `import()` is part of es modules.\r\n\r\nHowever, it compiles correctly but throw annoing error.\r\n\r\nI created [a repository](https://github.com/Nitive/typescript-dynamic-import) to reproduce an error.\r\n`npm run build-ts`: compile ts files into `build/` folder.\r\n`npm run build-webpack`: compile js into `dist/`. (Then open `index.html` to see that everything works fine)\r\n","author":{"url":"https://github.com/Nitive","@type":"Person","name":"Nitive"},"datePublished":"2017-06-21T08:11:42Z","url":"https://github.com/microsoft/TypeScript/issues/16675"}

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:bd4f5811-9d9c-0108-3e8b-a83493f5dfe5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8DEE:21BD98:251CBD6:2F1EE4E:6B01C2C6
html-safe-nonceaa408f3853dfbbe9c76d51c594c0f140c072c74472c95c02d2808aa13784e818
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REVFOjIxQkQ5ODoyNTFDQkQ2OjJGMUVFNEU6NkIwMUMyQzYiLCJ2aXNpdG9yX2lkIjoiMzAxNjY1NDMyNjA2MDkyNTYzOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaccb256259c316b34a411862a1f65e74e5aab8cbaf414e1041671793ac80f48f8c
hovercard-subject-tagissue:237449209
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/16675/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b94bc01fd874942eec347d7624bf3b31a64bbff3a8c82a42ec79ad9b71c2d7b1/microsoft/TypeScript/issues/16675
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b94bc01fd874942eec347d7624bf3b31a64bbff3a8c82a42ec79ad9b71c2d7b1/microsoft/TypeScript/issues/16675
og:image:altTypeScript Version: 2.4.0 Code import('./utils') .then(({ sum }) => { console.log(sum(1, 2)) }) .catch(console.error) tsconfig.json (short version) { "compilerOptions": { "moduleResolution": "node"...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNitive
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/16675#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F16675
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%2F16675
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/16675
Reloadhttps://github.com/microsoft/TypeScript/issues/16675
Reloadhttps://github.com/microsoft/TypeScript/issues/16675
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests312 (312)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/16675
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/16675
Error when trying to use dynamic import with module: "es2015"https://github.com/microsoft/TypeScript/issues/16675#top
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: Error MessagesThe issue relates to error messaginghttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Error%20Messages%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.9https://github.com/microsoft/TypeScript/milestone/67
https://github.com/Nitive
Maxim Samoilov (Nitive)https://github.com/Nitive
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issue-237449209
Example repositoryhttps://github.com/Nitive/typescript-dynamic-import
a repositoryhttps://github.com/Nitive/typescript-dynamic-import
Nexthttps://github.com/microsoft/TypeScript/issues/16675?timeline_page=1
Maxim Samoilov (Nitive)https://github.com/Nitive
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#event-1132409831
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-309999772
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: Error MessagesThe issue relates to error messaginghttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Error%20Messages%22
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#event-1132410915
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-309999904
https://github.com/Nitive
Maxim Samoilov (Nitive)https://github.com/Nitive
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-310001797
Maxim Samoilov (Nitive)https://github.com/Nitive
on Jun 21, 2017https://github.com/microsoft/TypeScript/issues/16675#event-1132708510
Fix error about dynamic importhttps://github.com/Nitive/typescript-dynamic-import-example/commit/aeba95fa9657d01d5ec67b4584a14c4fa1f7f7f8
aeba95fhttps://github.com/Nitive/typescript-dynamic-import-example/commit/aeba95fa9657d01d5ec67b4584a14c4fa1f7f7f8
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
Effort: Easyhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Effort%3A%20Easy%22
on Jun 28, 2017https://github.com/microsoft/TypeScript/issues/16675#event-1142976554
https://github.com/Sebazzz
Sebastiaan Dammann (Sebazzz)https://github.com/Sebazzz
on Sep 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-331223225
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 21, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-331299140
https://github.com/Sebazzz
Sebastiaan Dammann (Sebazzz)https://github.com/Sebazzz
on Sep 22, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-331360560
https://github.com/codeaid
codeaidhttps://github.com/codeaid
on Nov 2, 2017https://github.com/microsoft/TypeScript/issues/16675#issuecomment-341467673
Maxim Samoilov (@Nitive)https://github.com/Nitive
Daniel Rosenwasser (@DanielRosenwasser)https://github.com/DanielRosenwasser
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Nov 2, 2017https://github.com/microsoft/TypeScript/issues/16675#event-1323774142
https://github.com/hnviradiya9
H Viradiya (hnviradiya9)https://github.com/hnviradiya9
on Mar 25, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-375982128
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Mar 27, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-376354119
H Viradiya (@hnviradiya9)https://github.com/hnviradiya9
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
TypeScript 2.9https://github.com/microsoft/TypeScript/milestone/67
on May 9, 2018https://github.com/microsoft/TypeScript/issues/16675#event-1618073191
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on May 9, 2018https://github.com/microsoft/TypeScript/issues/16675#event-1618073538
Merge pull request #23957 from paulkoerbitz/16675-better-error-messag…https://github.com/microsoft/TypeScript/commit/9ea4d93823a9e867988d9a53c903dde691ea2d56
#23957https://github.com/microsoft/TypeScript/pull/23957
https://docs.github.com/articles/closing-issues-via-commit-messages
9ea4d93https://github.com/microsoft/TypeScript/commit/9ea4d93823a9e867988d9a53c903dde691ea2d56
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on May 9, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-387801608
Paul Koerbitz (@paulkoerbitz)https://github.com/paulkoerbitz
https://github.com/sherlock1982
Nikolai Orekhov (sherlock1982)https://github.com/sherlock1982
on May 14, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-388912091
https://github.com/bennypowers
Benny Powers (bennypowers)https://github.com/bennypowers
on May 27, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-392353963
https://github.com/tomavic
Hatem (tomavic)https://github.com/tomavic
on May 28, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-392454962
Benny Powers (@bennypowers)https://github.com/bennypowers
https://github.com/facundocoto
Facundo Coto (facundocoto)https://github.com/facundocoto
on Jun 7, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-395504061
https://github.com/tomavic
Hatem (tomavic)https://github.com/tomavic
on Jun 10, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-396034567
Facundo Coto (@facundocoto)https://github.com/facundocoto
https://github.com/facundocoto
Facundo Coto (facundocoto)https://github.com/facundocoto
on Jun 12, 2018https://github.com/microsoft/TypeScript/issues/16675#issuecomment-396625295
Hatem (@tomavic)https://github.com/tomavic
https://github.com/enjikaka
Jeremy Karlsson (enjikaka)https://github.com/enjikaka
on Jan 3, 2019https://github.com/microsoft/TypeScript/issues/16675#issuecomment-451257607
https://github.com/DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
on Jan 3, 2019https://github.com/microsoft/TypeScript/issues/16675#issuecomment-451260222
Jeremy Karlsson (@enjikaka)https://github.com/enjikaka
SchemaStore/schemastore#602https://github.com/SchemaStore/schemastore/pull/602
https://github.com/ferencbalogh
Balogh Ferenc (ferencbalogh)https://github.com/ferencbalogh
on Feb 9, 2019https://github.com/microsoft/TypeScript/issues/16675#issuecomment-462077617
https://github.com/syed-mustaqhim
Syed Mustaqhim (syed-mustaqhim)https://github.com/syed-mustaqhim
on May 8, 2022https://github.com/microsoft/TypeScript/issues/16675#issuecomment-1120392421
hnviradiya9https://github.com/hnviradiya9
https://github.com/ShemiNechmad
Shemi (ShemiNechmad)https://github.com/ShemiNechmad
on Jul 24, 2023https://github.com/microsoft/TypeScript/issues/16675#issuecomment-1647280971
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/16675#event-20415456541
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/16675
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/16675
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
Domain: Error MessagesThe issue relates to error messaginghttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Domain%3A%20Error%20Messages%22
FixedA PR has been merged for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fixed%22
TypeScript 2.9https://github.com/microsoft/TypeScript/milestone/67
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.