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

[bug] importing JSON doesn't work in bundles #4101

Closed
kitsonk opened this issue Feb 24, 2020 · 0 comments · Fixed by #4404
Closed

[bug] importing JSON doesn't work in bundles #4101

kitsonk opened this issue Feb 24, 2020 · 0 comments · Fixed by #4404

Comments

@kitsonk
Copy link
Contributor

kitsonk commented Feb 24, 2020

Breaking this out of #4062 as the fix might land differently.

JSON is not importable to bundles currently. This is because we need to do the transformation into an ESM ourselves, as TypeScript will strongly type it, but expects the host to do the transformation.

kitsonk added a commit to kitsonk/deno that referenced this issue Mar 16, 2020
Fixes denoland#4101

Previously, we would just provide the raw JSON to the TypeScript
compiler worker, but TypeScript does not transform JSON.  This caused
a problem when emitting a bundle, that the JSON would just be "inlined"
into the output, instead of being transformed into a module.

This fixes this problem by providing the compiled JSON to the TypeScript
compiler, so TypeScript just sees JSON as a "normal" TypeScript module.
kitsonk added a commit to kitsonk/deno that referenced this issue Mar 17, 2020
Fixes denoland#4101

Previously, we would just provide the raw JSON to the TypeScript
compiler worker, but TypeScript does not transform JSON.  This caused
a problem when emitting a bundle, that the JSON would just be "inlined"
into the output, instead of being transformed into a module.

This fixes this problem by providing the compiled JSON to the TypeScript
compiler, so TypeScript just sees JSON as a "normal" TypeScript module.
@ry ry closed this as completed in #4404 Mar 18, 2020
ry pushed a commit that referenced this issue Mar 18, 2020
Fixes #4101

Previously, we would just provide the raw JSON to the TypeScript
compiler worker, but TypeScript does not transform JSON.  This caused
a problem when emitting a bundle, that the JSON would just be "inlined"
into the output, instead of being transformed into a module.

This fixes this problem by providing the compiled JSON to the TypeScript
compiler, so TypeScript just sees JSON as a "normal" TypeScript module.
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 a pull request may close this issue.

1 participant