-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
No compile-time error is produced for import 'nonexistent_filename'
. An error is produced for nonexistent named imports (e.g. import X from './notExist.js'
), but for anonymous imports (when simply importing for side effects) no error is produced if the file doesn't exist, the import is emitted as-is, and the code fails at runtime.
TypeScript Version: 3.2.0-dev.20181020
Search Terms: anonymous import no error
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
import foo from './doesnt-exist-1.js';
import './doesnt-exist-2.js';
Expected behavior:
2 errors should be produced:
- Cannot find module
./doesnt-exist-1.js
- Cannot find module
./doesnt-exist-2.js
Actual behavior:
Only 1 error is produced:
- Cannot find module
./doesnt-exist-1.js
Playground Link:
http://www.typescriptlang.org/play/#src=import%20foo%20from%20'.%2Fdoesnt-exist-1.js'%3B%0D%0Aimport%20'.%2Fdoesnt-exist-2.js'%3B%0D%0A
Related Issues:
Couldn't find any.
jameslnewell
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created