-
Notifications
You must be signed in to change notification settings - Fork 71
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
Vitest Failed to resolve entry for package "@azure/communication-react" #5451
Comments
I could make it work with this Vitest config pointing to cjs. test: {
globals: true,
environment: 'jsdom',
setupFiles: 'src/setupTests.ts',
alias: {
'@azure/communication-react': path.resolve(
__dirname,
'node_modules/@azure/communication-react/dist/dist-cjs/communication-react/index.js',
),
},
},
}); |
Hi @DercilioFontes, thanks for filing this issue. I will have a discussion with my team about this and let you know. |
@DercilioFontes Could you share your typescript config? You need to be using certain resolver to pick up the entry points. Just to note, VItest seems to work better with node.js environment |
Hi @mgamis-msft Sure.
{
"compilerOptions": {
"target": "ES2022",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"types": ["vitest/globals"]
},
"include": ["src", "types", "types/i18next.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
} |
Hi @mgamis-msft After updating to I'm closing the issue. Thank you for your attention. |
Describe the bug; what happened?
I updated the "@azure/communication-react" to version 1.21.0. Before, tests worked fine with version 1.18.1. However, I also updated Vite to v6 and Vitest to 2.1.6.
When trying to run the tests with Vitest, I get this error:
The build and app works fine.
I couldn't figure out how to solve it. Could it be a problem with how the package
package.json
is configured?I checked the package in this tool, and it suggests some changes. Could it help?
https://publint.dev/@azure/[email protected]
However, it could also be some configuration with Vitest and Vite to fix it. Could you guys give some advice about that?
What are the steps to reproduce the issue?
Probably a new project with Vite, Vitest and @azure/communication-react to test it.
What behavior did you expect?
To resolve the import properly
If applicable, provide screenshots:
In what environment did you see the issue?
Is there any additional information?
The text was updated successfully, but these errors were encountered: