-
Notifications
You must be signed in to change notification settings - Fork 5.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Sharing code with browsers: .ts extension issue #3846
Comments
Are you compiling with |
The client side is compiled with
Do I understand correctly that you suggest compiling/bundling the client side with Deno as well (via All in all, I do not think that compiling/bundling the client side code with Deno is the proper way to go. |
I'm not suggesting using |
Right! Ideally, I would love
This sounds like an interesting option. Will give them a try. |
At least the interop between Deno and |
It does, but does not really work with transpiled files; they have type information stripped from them. Here are two possible approaches, both failing at various places.
// deno-server.ts:
import { SomeType } from "./browser/some-type.ts"; // server side: works when compiling with Deno
// browser/some-type.ts:
import other from "./other.ts"; // client side: fails, tsc does not expect .ts
// deno-server.ts:
import { SomeType } from "./browser/some-type.js"; // server side: fails, this is a transpiled file without type information
// browser/some-type.ts:
import other from "./other.js"; // client side: works |
To sum things up: with Deno, I cannot import a tsc-compiled dependency that has other dependencies. |
While this evaded me before now, I think we will be able to fix it in #4538 for |
No, I am not doing These direct dependencies go to All in all, I do not think this is a bug in Deno, because I do not see a proper Deno-based solution for this scenario. All my source files are TypeScript, so they all shall have a .ts extension. Unfortunately, the need for client-side TS compilation is forcing me to use .js, Deno-incomaptible. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
Is anything here actionable for us? If not I would like to close and move the discussion to https://github.com/denoland/deno/discussions or https://discord.gg/deno. |
I'm ok with that. Please post here the link to the new discussion if you move it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Hi,
for my current Deno project, I tried re-using some of the existing code initially written for a browser. This works:
However, I run into issues when the
browser-module
depends on other files:...because Deno requires the use of .ts extension. The whole browser-side setup works either with .js (as my .ts files are compiled down to .js) or without extensions at all, because TSC seems to be smart enough. But I am unable to use .ts (required by Deno) with TSC -- it fails with
Any ideas? Thanks!
The text was updated successfully, but these errors were encountered: