-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Describe the bug
I'm using these libraries in a tanstack start project which is performing tree shaking. This means that '@microsoft/msgraph-sdk-users' gets tree-shaken out an error is raised. See log output below.
Expected behavior
No exception
How to reproduce
use any framework that treeshakes and make any API call with the library
SDK Version
^1.0.0-preview.51
Latest version known to work for scenario above?
haven't used previous versions
Known Workarounds
You can work around this by tricking the treeshaking as follows
import * as users from
import * as groups from '@microsoft/msgraph-sdk-groups';
// NOTE: The strange import above and the console.log below is a hack to prevent tree shaking
console.log(typeof users);
console.log(typeof groups);Debug output
Click to expand log
``` Apr 3, 10:07:24 AM: a4534f80 ERROR Token validation failed Error: couldn't find navigation property users data: {} at Object.get (file:///var/task/node_modules/@microsoft/kiota-abstractions/dist/es/src/apiClientProxifier.js:211:23) at ne$1 (file:///var/task/chunks/nitro/nitro.mjs:4460:183) at async file:///var/task/chunks/nitro/nitro.mjs:4472:13 at async file:///var/task/chunks/nitro/nitro.mjs:4508:75 at async file:///var/task/chunks/nitro/nitro.mjs:4501:15 at async le$1 (file:///var/task/chunks/nitro/nitro.mjs:4499:79) at async Object.ie$1 [as handler] (file:///var/task/chunks/nitro/nitro.mjs:4483:10) at async file:///var/task/chunks/nitro/nitro.mjs:1551:19 at async Object.callAsync (file:///var/task/node_modules/unctx/dist/index.mjs:72:16) at async toNodeHandle (file:///var/task/chunks/nitro/nitro.mjs:1822:7) ```Configuration
- OS: Ubuntu 24.10
- Architecture: x64
Other information
I think the solution to this might be adding something like the below to package.json
{
"sideEffects": ["./src/some-side-effectful-file.js"]
}or
{
"sideEffects": ["*.js"]
}