Closed runenielsen closed 1 year ago
From the contribution guidelines:
A good bug report shouldn't leave others needing to chase you up for more information.
I'm tempted to close the issue based on this alone, but I'll give you a chance.
I get this error when building:
What does this mean to you?
It should be reproducible with the example, since it imports from the same package: https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/quick-start.md
The examples are all tested in CI and run seemingly fine. You need to provide a runnable example without simply referring to documentation,
Just installed the latest version. Got the exact same issue.
@kogratte, set moduleResolution
to node16
in your TS config.
Works. Maybe should you update the doc accordingly?
Setting moduleResolution
to node16
doesn’t work for the application I’m working on as doing so causes some 200 new TypeScript errors across dozens of files in the project.
Among those errors are ones relating to CommonJS modules while treating the file as a true module, modules without type declarations (third party packages we don’t control), implicit anys, etc.
Is there any other way I can import createEsbuildPlugin
on v17?
@badeball : Alright, sorry, I didn't notice this in the release notes. But that works, thank you.
I will close this. And thanks for the great tool.
@kleinfreund, you can EG. write module definitions yourself as a workaround,
// declarations.d.ts
declare module "@badeball/cypress-cucumber-preprocessor/esbuild";
or map the path
// tsconfig.json
{
"compilerOptions": {
"paths": {
"@badeball/cypress-cucumber-preprocessor/esbuild": ["./node_modules/@badeball/cypress-cucumber-preprocessor/dist/bundler-utils/esbuild"]
}
}
}
@kleinfreund. this thread might give you more insight into what is going on with node16
resolution mode. Tldr is that many packages are wrongly configured. What packages are you having trouble with?
@badeball Thanks for the quick help. I think manually mapping the path in the tsconfig.json is an adequate workaround to this.
Tldr is that many packages are wrongly configured. What packages are you having trouble with?
From what I can see, the packages vite and urlpattern-polyfill are producing errors of the following form:
The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("urlpattern-polyfill")' call instead.
To convert this file to an ECMAScript module, change its file extension to '.mts', or add the field `"type": "module"` to '/home/phil/kong/kuma-gui/package.json'.
And as for missing declaration files, I only see vuex and an internal package producing errors such as these:
Could not find a declaration file for module 'vuex'. '/home/phil/kong/kuma-gui/node_modules/vuex/dist/vuex.cjs.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/vuex` if it exists or add a new declaration (.d.ts) file containing `declare module 'vuex';`
Most if not all of these errors probably have easily explainable reasons completely out of the responsibilities/sphere of influence of this project of course.
Current behavior
I get this error when building:
cypress.config.ts:4:33 - error TS2307: Cannot find module '@badeball/cypress-cucumber-preprocessor/esbuild' or its corresponding type declarations.
4 import createEsbuildPlugin from '@badeball/cypress-cucumber-preprocessor/esbuild';