Issues with tree-shaking
Maintainers usually reply within 8 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- build-system
Research direction
Start by reproducing the failure in a TanStack Start project using a tree-shaking build and an API call from @microsoft/msgraph-sdk-users; compare the behavior with the import workaround shown in the issue. Inspect the SDK package.json and the generated package entry points, then verify that the API call succeeds without console.log or extra imports and without the navigation-property error.
Written by the indexing model from the issue text.
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"]
}
- Dominant language
- TypeScript
- Stars
- 44
- Forks
- 7
- Avg merge
- 12h 40m
- Merged PRs (30d)
- 5
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoftgraph/msgraph-sdk-typescript
-
ToTriage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoftgraph/msgraph-sdk-typescript#917 · 6 comments ·
Maintainers usually reply within 8 days
-
status:waiting-for-triage ToTriage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoftgraph/msgraph-sdk-typescript#974 · 1 comment ·
Maintainers usually reply within 8 days
-
status:waiting-for-triage ToTriage type:bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
microsoftgraph/msgraph-sdk-typescript#953 · 1 comment · 1 reaction ·
Maintainers usually reply within 8 days
-
status:waiting-for-triage ToTriage
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoftgraph/msgraph-sdk-typescript#912 · 1 comment ·
Maintainers usually reply within 8 days
-
status:waiting-for-triage ToTriage type:feature
Difficulty 3/5 1-2 days Newbie friendliness 48/100
microsoftgraph/msgraph-sdk-typescript#908 ·
Maintainers usually reply within 8 days
All issues in microsoftgraph/msgraph-sdk-typescript
Similar issues
-
check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Fission-AI/OpenSpec#1986 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nestjs/docs.nestjs.com#3554 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
publicodes/publicodes#868 ·
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 78/100
EclipseFdn/open-vsx.org#13488 ·
Maintainers usually reply within 2 days