Can i migrate my Node based project to Deno?
Asked Answered
C

5

10

Hello I am a frontEnd developer.

First, I don't know much about the runtime environment.
Is it possible to convert my project into Deno with Node?

Even if I change all of my code,
I'm not sure if the libraries I've received can run in a Deno environment.
(too many libs...) (React, Apollo, many many many)

And since the current webpack settings are very complex and difficult to understand, (And I understand very little about the build system.)
I am not sure if this can work in a Deno environment.

In my opinion, it seems impossible, I will only use Deno when working on a new project, Or wait for someone to create a migration guide.

What do you think about this?

Add

Obviously, it would be impossible if the libraries I used were not registered in the Deno repository.

And second, there seems to be a node compatibility issue.

Now i am sure that i can't covert it to deno. Thanks

Candlewood answered 20/5, 2020 at 1:9 Comment(6)
Is your Node.js the REST API? Or for some reason you use it just to publish the build of your front-end react app?Transmarine
@Evandro Pomatti Just For publish the build of my front-end react app. API server is completely separated with client-appCandlewood
I see! You need to provision static files then. That should be possible with Deno with little effort. There is no compiling or conversion, just static files. You'd be using it as a proxy. Honestly, switch to ngnix! If you don't need dynamic content, you don't need Node.js nor Deno. I can't work on an answer right now thought, but see if that helps.Transmarine
@Evandro Pomatti This question dose not ask solution, but what should be considered. Your comment is absolutely helpful.Candlewood
@Evandro Pomatti With out Node, yes it will work but what about npm? I can't imagine build without that, i will think about your comment again... I see, you mean, it's a matter of develop method and build method. not work or not, because it is static. yes but I need a way to build practicallyCandlewood
You are using npm because of your React project. Once you build your bundle you can deliver it to any static files provider of your choice. Deno, ngnix, Node, apache, etc.Transmarine
L
5

You're using many npm packages in your node project.Deno doesn't work with them.So either you'll wait to deno to be mature enough or you're gonna keep building your projects with node until that time.So i think if you want to take full advantage of deno, you should wait for deno to mature

Luwian answered 20/5, 2020 at 1:16 Comment(1)
Apparently this is now not an issue anymore: deno.land/[email protected]/nodeHiddenite
S
8

There is Denoify.
This tool takes as input a TypeScript codebase that was meant to target node and/or the web and spits out a modified version of the source files that are ready to be deployed as a Deno module.
It also helps to deploy on both NPM and deno.land/x

However, it is still under active development, not all node builtins are supported yet and you will probably have to make some changes here and there on your codebase to comply with the requirement Denoify sets.

Also, I am the author.

repo

Squama answered 24/5, 2020 at 8:11 Comment(0)
L
5

You're using many npm packages in your node project.Deno doesn't work with them.So either you'll wait to deno to be mature enough or you're gonna keep building your projects with node until that time.So i think if you want to take full advantage of deno, you should wait for deno to mature

Luwian answered 20/5, 2020 at 1:16 Comment(1)
Apparently this is now not an issue anymore: deno.land/[email protected]/nodeHiddenite
B
5

Any code you write in pure JavaScript or TypeScript will work both in Node.js and Deno.

However, it's more than likely you have used Node.js-specific features in your current project. requires, calls to native Node.js APIs like http, util, and many others will not work in the Deno runtime.

Also, these kinds of Node.js-specific APIs are used in most Node.js libraries, so you'll have to do a complete rewrite to Deno.

Bice answered 20/5, 2020 at 2:15 Comment(0)
C
2

I am not sure enough but as you have a Node.js project you should be using npm packages so until and unless those npm packages you use have alternative Deno packages it isn't possible if not then as @IsaToltar said to wait for it to be mature enough.

but if you can tell us what third-party npm packages you use then we might be able to find an alternative Deno package for that.

I hope it helps.

Come answered 20/5, 2020 at 1:36 Comment(2)
Thanks and I didn't want to bother everyone with a long list. 😁 This means that if there are modules to alternative my npm module, it could theoretically be possible. But wait is more good option, and maybe I need to re-configure the webpack build.Candlewood
@Candlewood Well, I guess you have to in order for us to help you or maybe you can google the Deno alternatives for your node packages I am sure you'll find something.Come
C
-1

Deno now supports node-based projecs + NPM, it is considered to be stable, although still a work in progress.

To learn more, take a look at:

https://deno.land/[email protected]/node https://deno.land/[email protected]/node/how_to_with_npm https://deno.land/[email protected]/node/std_node

Come answered 11/1, 2023 at 16:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.