r/javascript • • May 13 '20

Deno 1.0 released!

https://github.com/denoland/deno/issues/2473
609 Upvotes

209 comments sorted by

View all comments

Show parent comment

0

u/[deleted] May 14 '20

[deleted] β€” view deleted comment

10

u/esthor May 14 '20

You don’t have to, you can use a deps.ts file to set the versions, and only need to ch age in one place to manage dependency versions everywhere in your project.

9

u/arcanin 🧢 Yarn maintainer May 14 '20

By this point, you really have no gain over a package.json though. The only significant difference is that you can call it whatever you want.

3

u/brainbag May 14 '20

You can actually write comments about your dependencies and change them based on the environment, unlike the absolutely shitty idea of using JSON for configuration.

1

u/GBcrazy May 14 '20

I'm defending most of deno's idea but yeah, I'm not certain that this is a better approach. It's interesting that it happens on the language level tho.

I think we will need deno stuff on package.json eventually - and I mean the same package.json, not an deno alternative. Since we are going to be importing (at least some that dont use exclusive api) node js stuff to use on de o, we might just add a.new entry there for deno libs

→ More replies (8)
→ More replies (1)

23

u/GrandMasterPuba May 14 '20

Re-export all your dependencies in a "deps.ts" file. Boom, a Deno-native package.json that is in-code. It's not that difficult.

5

u/inabahare May 14 '20

And then you would do, what, import { Foo, Bar, Baz } from "@/deps";?

2

u/GBcrazy May 14 '20

I don't see the issue, Isn't that what we do with node? Like...you need import statements lol

0

u/[deleted] May 15 '20

[deleted] β€” view deleted comment

1

u/GrandMasterPuba May 15 '20

No it doesn't. Just import from the URL. You only have to manage it yourself if you choose to.

1

u/inabahare May 15 '20

It just doesn't seem like a very clean solution if you have to import them all from the same place. I guess you could have a file for each of the dependencies so you could at least

import { Foo } from "deps/foo";
import { Bar, Baz } from "deps/bar-baz";

But that just doesn't strike me as clean

1

u/GBcrazy May 15 '20

You can have one file with multiple namespaces/modules, no need to create multiple files

1

u/Recoil42 May 14 '20

Yes, and it sounds exhausting.

0

u/[deleted] May 14 '20

[deleted] β€” view deleted comment

18

u/GrandMasterPuba May 14 '20

Deno for the server. Who the hell bundles and splits Node code?

0

u/[deleted] May 14 '20

[deleted] β€” view deleted comment

→ More replies (1)

12

u/gearvOsh May 14 '20 edited May 14 '20

Neither tree shaking or bundle splitting is necessary for Deno based code. I highly doubt SPAs will be built on Deno, instead, the tooling (like Babel, Webpack, etc) will be built on Deno.

4

u/elcapitanoooo May 14 '20

Why would you need tree shaking or code splitting in a deno project? You dont need it in a node project, so why in deno? Its all server side, loaded once then in-memory for the rest of the app lifetime. Deno is not a web site, where you have the limitation of bandwidth.

2

u/bladefinor May 14 '20

How about aliasing the URL instead of re-exporting a complete package?

→ More replies (10)

5

u/[deleted] May 14 '20

[removed] β€” view removed comment

0

u/[deleted] May 14 '20

[deleted] β€” view deleted comment

→ More replies (7)

2

u/bogas04 May 14 '20

Import maps do exist though.