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
When using the import declaration from the documentation
import { ZipCodeValidator } from "./ZipCodeValidator";
the latest Chrome will not find the 'ZipCodeValidator' file. The console will show an error "Failed to load resource: the server responded with a status of 404 (Not Found)".
This can be easily fixed by adding the ".js" suffix to the imported module.
import { ZipCodeValidator } from "./ZipCodeValidator.js";
On one hand, this is a documentation issue (the documentation does not follow implementation), on the other hand, it would be nice if the compiler generated the ".js" automatically.
Search Terms
import, module
Suggestion
When using the import declaration from the documentation
import { ZipCodeValidator } from "./ZipCodeValidator";
the latest Chrome will not find the 'ZipCodeValidator' file. The console will show an error "Failed to load resource: the server responded with a status of 404 (Not Found)".
This can be easily fixed by adding the ".js" suffix to the imported module.
import { ZipCodeValidator } from "./ZipCodeValidator.js";
On one hand, this is a documentation issue (the documentation does not follow implementation), on the other hand, it would be nice if the compiler generated the ".js" automatically.
Please see #27287
Use Cases
TS script:
import { ZipCodeValidator } from "./ZipCodeValidator";
Generated ES6:
import { ZipCodeValidator } from "./ZipCodeValidator";
This is invalid and will not work.
Examples
TS script:
import { ZipCodeValidator } from "./ZipCodeValidator";
Generated ES6:
import { ZipCodeValidator } from "./ZipCodeValidator.js";
The compiler will add the ".js" to the module filename.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: