Skip to content
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

fix(npm): handle json files in require #16125

Merged
merged 2 commits into from
Oct 1, 2022

Conversation

bartlomieju
Copy link
Member

Closes #16118

@bartlomieju bartlomieju merged commit 048c06f into denoland:main Oct 1, 2022
@bartlomieju bartlomieju deleted the fix_require_json branch October 1, 2022 20:23
Comment on lines +753 to +758
if media_type == MediaType::Json {
return Ok(CjsAnalysis {
exports: vec![],
reexports: vec![],
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just going to make programs expecting JSON data fail at runtime? I'm not sure how aligned to CJS Deno is going to be in compat mode though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How so? I added a test that requires data from JSON file and it works as expected.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I misunderstood the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to resolve JSON files when using npm specifiers
3 participants