question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unclear how to use nuxt 2.9 programmaticly with typescript

See original GitHub issue

What problem does this feature solve?

Hello, I use nuxt 2.8 with typescript and koa, so far I was able to get things to work using cross-env NODE_ENV=development ts-node-dev -P ./server/tsconfig.json --transpile-only server/index.ts --watch server for my dev script and nuxt build && tsc -p ./server/ for my build script

With nuxt 2.9 I have to use nuxt-ts to make nuxt compile my vuex modules, if I dont I get this error: [vuex] module namespace not found in mapGetters(): But if I use nuxt-ts then my server wont run, how am I suppose to do this correctly?

What does the proposed changes look like?

Add some documentation about running nuxt problematically.

<div align="right">This feature request is available on Nuxt community (#c9844)</div>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:11

github_iconTop GitHub Comments

1reaction
kevinmarreccommented, Oct 17, 2019

Programmatic usage is documented, but not for TypeScript. Overall all internals of nuxt aren’t typed, which means Nuxt & Builder classes are not easy to use (you need to @ts-ignore). See https://github.com/nuxt/typescript/issues/44

why is programmatic usage are not recommended by the way?

Overall it add complexity and people asking for help, meanwhile more convenient solutions may/must fit your use cases.

I highly recommend a blog post from one of our core team members @manniL : https://blog.lichter.io/posts/nuxt-with-an-api

Having your server both delivering vue app & serving api means you’re limiting your application to be a Monolith, which in other means : one single block, indivisible, slow/hard to change.

Separating your frontend (Nuxt) and your backend (API) makes thing easier in several fields :

  • Recruitment: focus on recruting specialists in frontend (Vue.js/Nuxt), or backend (Node.js, Laravel, etc…)
  • Maintenance : Independent versioning and separation of concerns just make things easier
  • Performance : If your server server API requests as well as SSR Nuxt renders, it may happen it results in really slow page display when API is heavily requested. It also comes with resources used by your servers. With a monolith it will become really hard to know if a RAM issue is cause by Nuxt or your Express (or other lib) server.

There are probably many other advantages but won’t enumerate all.

Still, Nuxt programmatic usage can answer to some use cases i’m not aware of OR not experienced in.

0reactions
kevinmarreccommented, Dec 8, 2019

Closed by #233

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setup - Nuxt TypeScript
Check official TypeScript documentation to learn about the different compiler options. If you are using Nuxt programmatically with a custom server framework, ...
Read more >
Run Nuxt 3 programmatically - typescript - Stack Overflow
First of all, I recommend using @nuxt/kit for this purpose as nuxt 3 is not providing the same way as nuxt 2 in...
Read more >
Power a Nuxt application with TypeScript | by Alain Seng
Nuxt recently (January 2019) released the 2.4.0 version pushing ... From Nuxt 2.9 and on-ward, please use the official TypeScript support of Nuxt: ......
Read more >
Nuxt, Next, Nest! Confused? - Codersera
js is a framework for building efficient, scalable Node.js server-side applications. It is the modern JavaScript, which is built with TypeScript and uses...
Read more >
Use TypeScript on Nuxt.js from v2.5 | by Kengo Hamasaki / hmsk
To have typings for Nuxt-ish things for example asyncData , fetch on the components. Add @nuxt/vue-app (provided by @nuxt/typescript npm module) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found