You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doing import "./other"; will not raise a Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './other.mjs'? error.
Does not error unless I change the import to have a default, namespace, or named import. Output will fail at runtime.
======== Resolving module './other' from 'V:/tsc-issues/main.mts'. ========
Explicitly specified module resolution kind: 'NodeNext'.
Resolving in ESM mode with conditions 'node', 'import', 'types'.
Loading module as file / folder, candidate module location 'V:/tsc-issues/other', target file types: TypeScript, JavaScript, Declaration.
Directory 'V:/tsc-issues/other' does not exist, skipping all lookups in it.
======== Module name './other' was not resolved. ========
File 'V:/tsc-issues/node_modules/typescript/lib/package.json' does not exist.
Found 'package.json' at 'V:/tsc-issues/node_modules/typescript/package.json'.
File 'V:/tsc-issues/node_modules/typescript/lib/package.json' does not exist according to earlier cached lookups.
File 'V:/tsc-issues/node_modules/typescript/package.json' exists according to earlier cached lookups.
...etc...
🙂 Expected behavior
Should error because no extension used.
The text was updated successfully, but these errors were encountered:
Side-effect imports like this have never been checked that they resolve whatsoever. @DanielRosenwasser and I briefly discussed whether we could change this, but I don’t know if there was a consensus. It would definitely be a breaking change.
Interesting. Well overall it's not really that big of a deal since people will get an immediate error when running the code and people rarely write these kind of imports.
Bug Report
Doing
import "./other";
will not raise aRelative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './other.mjs'?
error.🔎 Search Terms
import specifier only side effects
🕗 Version & Regression Information
5.0.0-dev.20230110
⏯ Playground Link
Here's a repo: https://github.com/dsherret/tsc-issues/tree/importOnlySpecifier
💻 Code
🙁 Actual behavior
Does not error unless I change the import to have a default, namespace, or named import. Output will fail at runtime.
🙂 Expected behavior
Should error because no extension used.
The text was updated successfully, but these errors were encountered: