Title: Allow `--module commonjs --moduleResolution bundler` by andrewbranch · Pull Request #62320 · microsoft/TypeScript · GitHub
Open Graph Title: Allow `--module commonjs --moduleResolution bundler` by andrewbranch · Pull Request #62320 · microsoft/TypeScript
X Title: Allow `--module commonjs --moduleResolution bundler` by andrewbranch · Pull Request #62320 · microsoft/TypeScript
Description: Prerequisite for #62200 This has worked in a coherent way since --module preserve was implemented, but was prohibited with a program error. --moduleResolution bundler (like every other modern TS resolution mode) resolves package.json "exports" conditions according to the output module syntax being emitted. So in --module commonjs, imports in .ts and .js files always resolve with the "require" condition set. This combination of settings is very rarely going to be what people actually want, and is mostly intended as a "my code works, don't bother me" upgrade path for users on --module commonjs --moduleResolution: node. (More poignantly, it doesn't seem like deprecating --module commonjs is an option at this point, and with --moduleResolution node10 going away, that leaves no moduleResolution settings left that are legal with commonjs.) However, it's also the correct settings for anyone transpiling their code to CommonJS before resolving imports through a bundler. This includes Webpack ts-loader users who have --module commonjs in their ts-loader tsconfig. However, you should not use this combination of settings just because you set your bundler's output to emit a CommonJS module, so our docs / blog post need to be intentional about highlighting this.
Open Graph Description: Prerequisite for #62200 This has worked in a coherent way since --module preserve was implemented, but was prohibited with a program error. --moduleResolution bundler (like every other modern TS re...
X Description: Prerequisite for #62200 This has worked in a coherent way since --module preserve was implemented, but was prohibited with a program error. --moduleResolution bundler (like every other modern TS re...
Opengraph URL: https://github.com/microsoft/TypeScript/pull/62320
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:55cf2dba-acd9-742b-d0e2-dcc5f5c314d1 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A004:1C9FF9:1580122:1DDB117:6A61C635 |
| html-safe-nonce | 1959556bd0dfb06ef4bbd051e8980b592069eb612bfb2c5ec37f620a68660575 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDA0OjFDOUZGOToxNTgwMTIyOjFEREIxMTc6NkE2MUM2MzUiLCJ2aXNpdG9yX2lkIjoiMzUwNTk4MDcwNDg4MTIyOTMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 38aa642e52781ddc863d9468603681427ec1f4f16461aade990bc2c21cd3d5cd |
| hovercard-subject-tag | pull_request:2766978806 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/microsoft/TypeScript/pull/62320/files |
| twitter:image | https://avatars.githubusercontent.com/u/3277153?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3277153?s=400&v=4 |
| og:image:alt | Prerequisite for #62200 This has worked in a coherent way since --module preserve was implemented, but was prohibited with a program error. --moduleResolution bundler (like every other modern TS re... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6f4633bcf01c1ad14b73fd07dd39ac31d61f3d3c2578ee08ec1792b7b351eeb9 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ac296ae7f21856f1f92adbad22f870b6fbb4b907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width