GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — `--moduleResolution bundler` (formerly known as `hybrid`) by andrewbranch · Pull Request #51669 · microsoft/TypeScript Conversation
|
| classic | node | node16 | bundler | |
|---|---|---|---|---|
node_modules packages |
✅ | ✅ | ✅ | |
| extensionless | ✅ | ✅ | CJS only | ✅ |
| directory index | ✅ | ✅ | CJS only | ✅ |
*.ts imports |
✅ | |||
package.json exports |
✅ | ✅ | ||
exports conditions |
always node, types;import from ESM,require from CJS;custom additions |
always types, import;custom additions |
--moduleResolution bundler does not support resolution of require calls. In TypeScript files, this means the import mod = require("foo") syntax is forbidden; in JavaScript files, require calls are not errors but only ever return the type any (or whatever an ambient declaration of a global require function is declared to return).
allowImportingTsExtensions: Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set.resolvePackageJsonExports: Use the package.json 'exports' field when resolving package imports. Enabled by default in node16, nodenext, and bundler.resolvePackageJsonImports: Use the package.json 'imports' field when resolving imports. Enabled by default in node16, nodenext, and bundler.customConditions: Conditions to set in addition to the resolver-specific defaults when resolving imports. Valid in node16, nodenext, and bundler.resolvePackageJsonExports and resolvePackageJsonImports be disableable in node16 and nodenext? I see no valid reason to disable them in those modes, but I haven’t yet prohibited it.
*.ts imports to resolve in every module resolution mode, or at least node16 and nodenext, to improve consistency and (importantly) portability of .d.ts files between modes. I think Wesley Wigham (@weswigham) has already done this in another open PR, so perhaps it won’t be too controversial.
bundler become the new default resolution mode for --module commonjs? I would like to rename node to node10 in a follow-up PR, and stop maintaining it going forward. It is not a good choice for anyone since Node 10 is long out of service.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Andrew Branch (@andrewbranch) why does I've been trying to make a package with conditional exports that use And |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
It doesn’t; #52940 removed it. I’ll update the PR description since docs still aren’t on the website (😬) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Okay great! Thanks for letting me know |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Andy Edwards (@jedwards1211) No problem. I assume you’re aware that Webpack, and I assume other bundlers too, do apply the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Andrew Branch (@andrewbranch) so I've learned recently...and even Deno does, somewhat surprisingly |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I found this setting fixed a long running problem I had (yay!). In trying to learn more about it I checked out https://www.typescriptlang.org/tsconfig#moduleResolution , https://www.typescriptlang.org/docs/handbook/modules.html , and https://www.typescriptlang.org/docs/handbook/module-resolution.html and none of them cover it. What's the best reference for details (this PR discussion is rather long)? Hopefully the docs will be updated soon. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I’m updating the tsconfig.json reference now. It’s very hard to include |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The release notes for TypeScript 5.0 recommend using "bundler" when using tools like Vite, esbuild, Webpack, and so on. - Docs (which unfortunately don't say much): https://www.typescriptlang.org/tsconfig#moduleResolution - See also this PR: microsoft/TypeScript#51669
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Support package.jsonexports outside of Node
Feature Request: tsconfig option "conditions=x,x,x," "exportConditions" with moduleResolve: node<any> and nodenext and or importMap support
Remove "An import path cannot end with a '.ts' extension" check (rewriting out-of-scope)
allow voluntary .ts suffix for import paths
Suppressing "The import path cannot end with a '.ts' extension" error?
There was an error while loading. Please reload this page.