Duncan
Duncan•3d ago

Migrating from Node to Deno

I have been tasked with researching the feasibility of migrating our react/nextjs app from node/npm to deno. I have done the following so far: 1) Cloned the repo 2) deno install 3) deno task dev 4) things seem to work fine 5) Start opening files and see that deno complains a lot about a lack of file extensions plus needing curly braces which is due to ECMA script modules. Will I need to create a script to go through entire project fixing the imports? 6) Also see that the @ we use for our src path alias doesn't work. Not sure what the recommended steps are to migrate from a project like this (medium sized). I've googled migrating but only found 1 article and that wasn't particularly helpful
4 Replies
marvinh.
marvinh.•3d ago
5. The linter can add the appropriate extension automatically, see https://docs.deno.com/lint/rules/no-sloppy-imports/ 6. You likely have the aliasing defined in tsconfig.json . Deno doesn't read that. Add the alias in deno.json for Deno to pick it up:
{
"imports": {
+ "@/": "./src/"
}
}
{
"imports": {
+ "@/": "./src/"
}
}
Duncan
DuncanOP•3d ago
Thanks, I'll try that!
Doctor 🤖
Doctor 🤖•2d ago
Does deno lint offer a way to fix the things it complains about?
marvinh.
marvinh.•2d ago
Not for every rule, but some gave fixes. When they do the lint summary that's printed at the end will tell you if any errors can be fixed automatically with --fix

Did you find this page helpful?