Title: Can’t resolve `@types` when vendoring dependencies for browser ESM imports · Issue #50600 · microsoft/TypeScript · GitHub
Open Graph Title: Can’t resolve `@types` when vendoring dependencies for browser ESM imports · Issue #50600 · microsoft/TypeScript
X Title: Can’t resolve `@types` when vendoring dependencies for browser ESM imports · Issue #50600 · microsoft/TypeScript
Description: Bug Report 🔎 Search Terms native modules alias relative paths Relative references must start with either "/", "./", or "../". 🕗 Version & Regression Information This is the behavior in every version I tried, and I reviewed the FAQ for en...
Open Graph Description: Bug Report 🔎 Search Terms native modules alias relative paths Relative references must start with either "/", "./", or "../". 🕗 Version & Regression Information This is the behavior in every versio...
X Description: Bug Report 🔎 Search Terms native modules alias relative paths Relative references must start with either "/", "./", or "../". 🕗 Version & Regression Information Th...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/50600
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can’t resolve `@types` when vendoring dependencies for browser ESM imports","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\n - native modules alias relative paths\r\n - Relative references must start with either \"/\", \"./\", or \"../\".\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about declaration files\r\n\r\n### ⏯ Playground Link\r\n\r\nN/A (behavior is documented)\r\n\r\n### 💻 Code\r\n\r\nRelated frustrations have been posted many times before - so I've hesitated to post this: \r\n\r\nhttps://github.com/microsoft/TypeScript/issues/16577\r\nhttps://github.com/microsoft/TypeScript/issues/13422\r\nhttps://github.com/microsoft/TypeScript/issues/28288\r\nhttps://github.com/microsoft/TypeScript/issues/42151\r\n\r\nMy case, and workaround, are documented here: https://stackoverflow.com/questions/67725840/how-can-i-use-threejs-es6-native-modules-with-typescript/73575993#73575993\r\n\r\n### 🙁 Actual behavior\r\n\r\n1. The Declaration File must be included with an alias, e.g. `import * as THREE from 'three'`\r\n2. es6 modules require extensions, which the alias does not allow. TypeScript does and will not support URL rewriting.\r\n3. As a result, I cannot use Declaration Files + TypeScript without importing additional software \r\n\r\n### 🙂 Expected behavior\r\n\r\nThere could be multiple possible solutions here:\r\n\r\n1. Just document it better, here: https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html If this was described as a known limitation, it would have saved me half a day.\r\n\r\n2. Support aliases with extensions in one of two ways:\r\n a) Allow the alias itself to be of the final expected form `./js/lib/three.module.js`\r\n b) Allow some sort of a custom mapping, which I can use to tell tsc to look for an `.d.ts` alias `three` when it sees `./js/lib/three.module.js`\r\n\r\nThanks in advance!","author":{"url":"https://github.com/pehrlich2","@type":"Person","name":"pehrlich2"},"datePublished":"2022-09-01T23:52:14Z","url":"https://github.com/microsoft/TypeScript/issues/50600"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4c32a462-b4eb-76c3-63ec-771b4d5cb522 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87C6:24ACB9:F6D64B:14591F7:6B01022B |
| html-safe-nonce | a857e630f9a30ef970ea87228af783a5acd3cfc7cf4ae0f966f8b2d83a432cf7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0M2OjI0QUNCOTpGNkQ2NEI6MTQ1OTFGNzo2QjAxMDIyQiIsInZpc2l0b3JfaWQiOiI2MDAzMzQ2NTY3NjI3NjA0NTIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f2ff14fb2fec38607c2bab12237c9cc5da4b10a6c200e7e47119b769b81e6ffa |
| hovercard-subject-tag | issue:1359550921 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/50600/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f2a02830bb32f7f48ec625bd71b1a96dc2486aeb4091272ce7f1106c271df812/microsoft/TypeScript/issues/50600 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f2a02830bb32f7f48ec625bd71b1a96dc2486aeb4091272ce7f1106c271df812/microsoft/TypeScript/issues/50600 |
| og:image:alt | Bug Report 🔎 Search Terms native modules alias relative paths Relative references must start with either "/", "./", or "../". 🕗 Version & Regression Information This is the behavior in every versio... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | pehrlich2 |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width