-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using fully-qualified ESM imports with TypeScript #26827
Comments
Interesting - just for my curiosity is there a particular advantage/reason to prefer using a It looks like the There are a couple things you could try:
|
If he is using fully ESM you need to type |
@mike-plummer Using Regarding your suggestions:
|
I think this is probably your best option:
You could grab the latest one of When we update to webpack 5, this will likely "just work", but that isn't something that'll be landing prior to a major, since it's a pretty large and potentially breaking change. |
Closing since we upgraded to Webpack 5 and this should be resolved. |
This still doesn't work with cypress 13. Here is a test code to reproduce: https://github.com/mukulgupta21/cypress-ts-issue |
Current behavior
I have a fully-ESM project. I have a file
boolean.ts
like the following:I try to import a value into one of my Cypress test files with an import like the following:
This fails with the following error:
Desired behavior
Cypress should support TypeScript-style fully-qualified ESM imports where one can import a
.ts
file by using a.js
extension. In the context of this particular example,import ... from './modules.js
should importmodule.ts
.Test code to reproduce
https://github.com/nwalters512/cypress-esm-fully-qualified-import-repro. Ignore the fact that defining and importing a
TRUE
constant isn't a real-world scenario 😉Cypress Version
12.12.0
Node version
18.12.0
Operating System
macOS 13.3.1
Debug Logs
Other
I believe webpack's
resolve.extensionAlias
will be useful here. The example from their docs is probably pretty close to what you want:The text was updated successfully, but these errors were encountered: