-
Notifications
You must be signed in to change notification settings - Fork 35
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
Imports fail with Vite #325
Comments
I have had this error before, and have it again now. I have been able to work around it, by adding this to the ...
"main": "microsoft-graph.d.ts"
... then running the project using It somehow triggers the right re-scan. |
Setting I can can preproduce the error, by deleting my |
This is the full error, and is dubplicated for every file it is imported in, I have 6 identical errors X [ERROR] [plugin vite:dep-scan] Failed to resolve entry for package "@microsoft/microsoft-graph-types". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@microsoft/microsoft-graph-types". The package may have incorrect main/module/exports specified in its package.json.
node_modules/vite/dist/node/chunks/dep-c9998dc6.js:40970:10:
40970 │ throw new Error(`Failed to resolve entry for package "${id}". ` +
╵ ^
at packageEntryFailure (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:40970:11)
at resolvePackageEntry (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:40966:9)
at tryNodeResolve (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:40773:20)
at Context.resolveId (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:40581:28)
at Object.resolveId (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:39254:55)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async resolve (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:39466:26)
at async C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:39626:34
at async callback (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:933:28)
at async handleRequest (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:713:30)
This error came from the "onResolve" callback registered here:
node_modules/vite/dist/node/chunks/dep-c9998dc6.js:39616:18:
39616 │ build.onResolve({
╵ ~~~~~~~~~
at setup (C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:39616:19)
at handlePlugins (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:855:23)
at Object.buildOrServe (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:1149:7)
at C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:2110:17
at new Promise (<anonymous>)
at Object.build (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:2109:14)
at Object.build (C:\git\blf-teams-app\node_modules\esbuild\lib\main.js:1956:51)
at C:\git\blf-teams-app\node_modules\vite\dist\node\chunks\dep-c9998dc6.js:39414:54
at Array.map (<anonymous>)
The plugin "vite:dep-scan" was triggered by this import
script:C:/git/blf-teams-app/src/components/UserCard.vue?id=0:19:7:
19 │ import "@microsoft/microsoft-graph-types"
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
node_modules/vite/dist/node/chunks/dep-c9998dc6.js:40970:10: ERROR: [plugin: vite:dep-scan] Failed to resolve entry for package "@microsoft/microsoft-graph-types". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@microsoft/microsoft-graph-types". The package may have incorrect main/module/exports specified in its package.json. |
Same as these: |
This is still a problem, but can be patched with pnpm patch @microsoft/[email protected] Edit the package.json in the folder crated by diff --git a/package.json b/package.json
index 2b5ae34595613d3ad60879b20479e8520c7d10af..822ba59e34cdef3f9b556040b0e5825332c3aa13 100644
--- a/package.json
+++ b/package.json
@@ -4,6 +4,7 @@
"version": "2.40.0",
"license": "MIT",
"types": "microsoft-graph.d.ts",
+ "main": "microsoft-graph.d.ts",
"scripts": {
"test": "tsc && mocha spec/**.ts"
}, The follow the instructions given by |
Imports from
@microsoft/microsoft-graph-types
and@microsoft/microsoft-graph-types-beta
fail when using Vite, resulting in this error: [plugin vite:dep-scan] Failed to resolve entry for package "@microsoft/microsoft-graph-types-beta". The package may have incorrect main/module/exports specified in its package.json.The text was updated successfully, but these errors were encountered: