How to create a Nuxt 3 module | Socket.io

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Thank you Behon Baker for this amazing video 🔥. May you please make a video on a Fullstack App with Nuxt 3 ✨️. ( The database being Mongodb )

Anonymous-xyps
Автор

Awesome video, I like your presentation skills

dencam
Автор

Great tutorial. I iterated on some of this a bit and have it setup so it takes the folder structure under the socket folder and implements things like namespace, services, socket listeners, etc. The only problem I have with this is that file alias don't work with anything inside of the socket folder, so I end up with ugly paths like ../../utils/<helper>. I'm wondering if there's any solution to this. Also doesn't the listen hook only return the dev server? In production I had to spin up my own server.

antlion
Автор

There's a problem with import socket functions like this.

First they're imported into nuxt.config (which doesn't let you resolve aliases like ~/@/etc).

Second if you have any local modules imported using aliases inside of the socket function files you'll get an error because aliases cannot be resolved, and that error will propagate through out (so if you have a module of a module using an alias you're screwed). Modules imported from node_module are fine in this scenario, it's just local modules that you cannot use aliases with. I'm not sure if there's a solution to this considering how compilation works within nuxt.

This means you get stuck with using ugly relative paths like depending on where your files are located, and you'll be forced to use relative paths in any child module as well other wise you'll get a module not found error in the stack trace.

helix
Автор

great video .hi sir can you make full tutorial of nuxt with backend just like express

rence
Автор

It works great on the sandbox but when i add it to a project i get this error: Uncaught SyntaxError: import not found: default websocket-constructor.js:1:7

rodrigofernandes