-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
deno bundle
does not support tsconfig.json
#3793
Comments
I ran into this issue as well while trying to bundle a file with decorators. The CLI flags got cleaned up in #3365, so I'm not sure if removing |
|
Why not? It seems pretty reasonable for someone to want to create a bundled version of their browser based JS code by just running |
See #3726. This would allow one to easily create a userland module which acts as a compiler for browser code. This functionality shouldn't be explicitly be built-in. One awkward subcommand which has anything to do with frontend code, while no other does, wouldn't be reasonable. |
Maybe think of it this way. The web dev community have browserify, rollup, and webpack. All of these are essentially JS code bundlers for bundling front end code. Now Deno comes along and says "hey look everyone! We have code bundling built directly into the system. No plugins required!" Everyone goes and tries to use Deno to bundle their front end JavaScript just like how they have been using every single other code bundler before Deno. Then quickly everyone hits a brick wall when Deno says it doesn't understand browser code. You can see how this is just confusing and annoying for people right? |
@Dan503 If I did randomly assume that the bundle command on this runtime meant bundling for some other runtime, I would be annoyed at myself, sure. But the issue of whether or not to have this feature is discussed starting here #2475 (comment). The gist of it is that a "good" bundler does a lot more than what is already given here. It doesn't make any sense to build that into a server runtime that tries to be minimal. There's no problem with having to |
Even so, my issue was not being able to enable experimental decorators, which is still valid if you want to distribute a bundle without requiring someone else to add a |
It should support For bundling for a browser, you want to use |
I think @Dan503 is correct, his described case scenario happened to me.
I never assumed that Deno would only bundle for it's own run time, maybe that was naive, but I am sure I will not be the only person to think that. When you say 'some other run time', there really only is deno, node and the browser in the mainstream. Node can be considered legacy, so that leaves only two run times remaining. I would ask the Deno developers to consider that the vast majority of use for JS/TS is actually frontend browser code. Backend programming is minority interest. Most people install and use Node to run build tools and access NPM. Deno is a golden opportunity to interrupt this ancient and crufty practice and usher in a new era of simplicity and ease of use for the entire JS/TS community. Default ES Modules and getting rid of NPM is a revolution that would benefit everyone, not just back end coders. I am really hoping that Deno will evolve into a one stop shop for all JS/TS developers. One command line program that can compile, test, lint and format your code for the browser and itself. It can almost do that already. I appreciate that this might be a side goal for developers, but the opportunity to help so many people and move things forward should be seriously considered. It would make little difference if browser compatibility was done in the standard library or built in, just so long as it worked out of the box and was fully supported. #3726 looks fantastic, but please make sure its features are accessible out the box using the standard library. A new browser bundler could be included there, tree shaking etc could be added later. |
I think there are a few points... Treating "browser" as a single runtime is folly. While the evergreen browsers are adopting most features quite quickly, there are still quite a few gaps. Once you add in needing to target mobile browsers and IE11 (a reality for a lot of corporate environments), you now have a really uneven landscape still. It is far from a single runtime. The web platform is complicated, far more than just compliance with ECMAScript. It contains loads and loads and loads of APIs plus loads of other technologies (CSS, HTML, SVG, WebGL, WASM, WASI, etc.). Node.js being "legacy" is also a folly at this point. Even if Deno is super successful, and "replaces" Node.js, it would be a long long long road. Dismissing it, and its ability to continue to evolve is folly as well. I think the perspective that most development is "front end" in JavaScript is related to where individuals sit. My personal experience is there is loads and loads of JavaScript in the backend. I don't think non-frontend development is a minority interest at all. @ry and I chatted about this in general yesterday, what I think the outcome of the conversation was:
#3726 is part of that solution, but I will also work on adding stuff to |
I have always tought of There is a need for a browser-oriented bundle yeah, but the workload of all that functionality should be directed as a side-tool, and not a main goal of the project. Deno provides a set of tools that Node lacks or treats vaguely that were in many case solved by the community supporting Node, as is the case of Webpack, Prettier, ESLint (well maybe not that much) and make BackEnd development less of a hassle. However that makes Node much more of an empty shell, since must-have features are out of the reach if you only installed node and start programming with it. That has lead people to confuse between core functionality and plugins made to increase its reach in the Node environment. Deno's main function is to complement JS native lacks in the backend area much like Rust does (Lots of Deno toolset philosophy is based on Cargo, or at least it seems so). So even though Deno supports JSX you wouldn't expect it to have React integrated in it would you? Or a compatibility module with Node embedded in the code. That would be extras, since they go beyond the reach of the project, and are itself a large set of tools that requires to be mantained constantly. Webpack and Babel polyfill have been under constant development and improvement for years now, since legacy and not clear JS version system are such a delicate matter, so yes I would greatly prefer if they kept apart from the main Deno core. |
I feel it makes sense that compiling requires a target architecture. The arch type corresponding to a different transformer. That way transformers can be created in user space and added to deno. Say
But it takes into consideration the tsconfig.json As an unrelated side note, please resolve path transformations in both the emitted js and d.ts files. Oh my god writing a TS library with absolute paths is impossible. |
@alshdavid this type of flexibility is what |
I see the merge. It looks like you still have to write this though:
In order to compile using tsconfig.json, you should only have to write this: (and have tsconfig.json in the root folder)
|
@Dan503 we are always explicit about things in Deno. We will not automatically resolve |
@Dan503 As kitsonk pointed out, Deno wont resolve any kind of metadata unless you specify it to do so Don't see it as a disavantage though, since you are actually freeing yourself from compiler assumptions and have options to do things such as multiple They don't even need to be named |
I was expecting that it would default to using
|
@Dan503 Those are Node tools. Deno phylosophy aims to be as straight forward as possible, so...no unnecessary abstractions |
So I add a
tsconfig.json
to the root of the project:I still get the same error:
I go searching for an answer and based on this merged pull request it looks like I need to add
--config tsconfig.json
to the command.Deno version:
0.31.0
The text was updated successfully, but these errors were encountered: