Replies: 12 comments 18 replies
-
Are you compiling with |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I'm not suggesting using |
Beta Was this translation helpful? Give feedback.
-
Right! Ideally, I would love
This sounds like an interesting option. Will give them a try. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
To sum things up: with Deno, I cannot import a tsc-compiled dependency that has other dependencies. |
Beta Was this translation helpful? Give feedback.
-
While this evaded me before now, I think we will be able to fix it in #4538 for |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I'm ok with that. Please post here the link to the new discussion if you move it. |
Beta Was this translation helpful? Give feedback.
-
Hello, I/we would very much like to write Web-compatible modules in TypeScript (that only utilize Web compatible APIs) to JavaScript so that it works in Web browsers and/or other runtimes that can run ES2015 compatible JavaScript. Has there been any progress on this? I/we are fine with any build pipeline that does this, as long as it doesn't involve sentient beings changing ".ts" to ".js" (this is what computer software is for). |
Beta Was this translation helpful? Give feedback.
-
Hi, FYI: tsc now accepts .ts imports, so this issue/discussion is no longer relevant - at least in my original case. |
Beta Was this translation helpful? Give feedback.
-
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!
Beta Was this translation helpful? Give feedback.
All reactions