Nuxt integration?

I’ve successfully integrated Vue, however I usually work with Nuxt for my Vue projects and I’m having trouble integrating them together. Do you have any experience with a nuxt workflow? I’m guessing a Next.js workflow would be similar, too.

Original Post on Discord

by user 300386587278049291

I haven’t used nuxt before - I know of at least one company having built a project using next (I’m hestitant to ping them on a sunday tho - but can ask if they have experience/tips they can share tomorrow)

ok thanks! I promise if I can get this workflow setup I will be getting a commercial subscription - it’s my last major roadblock for integration into some upcoming projects

by user 300386587278049291

Thanks! Hopefully we will have a next.js template or sample soon too that can be used as a reference

Hello @danield4148 do you maybe have some insights that you can share on how to get this to work with nuxt? :slightly_smiling_face:

Just a small update…I’ve narrowed down some of the issues to the Vite config:

  • basicSsl was interfering with Nuxt’s websockets
  • needlePlugins was causing issues something to do with the ignore config
  • useGzip was causing issues

Now I’m stuck on getting the needle modules to load, I believe it’s an issue with the way the node_modules folder uses a symlink to the Unity library. Nuxt is following the symlink and relative paths are getting screwed up

by user 300386587278049291

@marcel :cactus: is there an easy way to get the /src and /dist folders generated into a different subfolder?

by user 300386587278049291

You can try to edit the needle.config.json - this is pretty experimental, exactly for next and nuxt cases but not really tested yet.

By default it contains:

{
  "buildDirectory": "dist",
  "assetsDirectory": "assets",
  "scriptsDirectory": "src/scripts",
  "codegenDirectory": "src/generated"
}

thanks will give it a whirl!

by user 300386587278049291

hey I think I’ve got it…needs some refinement but I’ll try to better outline all the steps, I have a feeling there are more elegant solutions than what I ended up with :smile:

by user 300386587278049291

Great to hear! Let me know what you need and will try to help make it better :slightly_smiling_face:

Hey! We worked with next and I think besides the naming similarities they’re quite different. However: We had a similar experience I guess. For now we went with keeping the projects separated instead of a real integration. Our next project has a Needle folder which holds the exported project. We copied the needle-engine package to a vendor folder within next and edited needle’s package.json to reference that one instead going to the unity project. In the end we just wrapped loading the needle generated js script and copy all assets to our public folder on file change

by user 827095900392259645

Thanks @danield4148, I essentially did the same thing, just pulling everything into public…I’ll share more info in this thread for @marcel :cactus: and crew to understand what else I had to change in the Vite config and Nuxt config

by user 300386587278049291

If you can share a miminal setup that we can replicate here it would be very helpful :slightly_smiling_face:

Hey, I was wondering if the minimal nuxt.js setup came to anything? Couldn’t see it amongst the samples on github, but perhaps it’s hosted elsewhere? Thanks

Hey there, you can check out a minimal example here, as it’s not on our Samples page yet:

Fun fact, our homepage https://needle.tools uses Nuxt at the moment :slight_smile:

1 Like

Thanks Felix, yeah I noticed it was using Nuxt (from Wappalyzer), it’s what prompted me to start playing around with the framework!

btw as a unity dev, this is such an exciting tool, no long build iterations and no script compilation before entering play mode, I’m tearing up! :face_holding_back_tears:

2 Likes

I’m very happy to hear that, and excited to see what you’ll make!

Personally I like Svelte/SvelteKit a bit more than Nuxt so far (and our samples website at Needle Engine Samples is built with that), but both are pretty great.

This topic was automatically closed 13 days after the last reply. New replies are no longer allowed.