https://github.com/loha/nuxt_2.10.2_vuex_bug
Nuxt correctly working with *.ts and *.js files in /store folder. Vuex work correctly. Project work like in https://github.com/nuxt-community/typescript-template.
If add in nuxt typescript project backend framework like koa.js of express.js nuxt ignore *.ts files in /store folder. Sometimes ignore *.js files too. For example, took the project https://github.com/nuxt-community/typescript-template and added the framework koa.js.
OS: Ubuntu 16.04 LTS
Node.js: v12.13.0
Try adding this to your nuxt.config:
build: {
additionalExtensions: ['ts', 'tsx'],
},
I have the same problem. In addition to build.additionalExtensions, I also had to set extensions. Without it, the .ts suffix wouldn't get removed from the module name.
{
extensions: ['ts', 'tsx'],
build: {
additionalExtensions: ['ts', 'tsx']
}
}
Could this be made default, please? Also, is the difference between the two settings documented somewhere? Why are there two anyway?
@nuxt/typescript-build should be registering these options in nuxt.config (reference).
@kevinmarrec Does this raise an issue with @nuxt/typescript-build, or is this a peculiarity with programmatic use of Nuxt?
@danielroe Thank you very much for your reply. Indeed, when adding additionalExtensions: ['ts', 'tsx'] , everything works. It would be nice if the Nuxt developers fixed it and that would be the default. When using the package @nuxt/typescript of an earlier version Nuxt(2.8.1), such problems do not arise.
@loha Having looked at your project, it is also fixed by changing the server code to:
// The next line needs to be run in dev as well as production.
await nuxt.ready()
if (config.dev) {
const builder = new Builder(nuxt)
await builder.build()
}
I think it would be worth having some documentation on this and will prepare a PR.
Most helpful comment
Try adding this to your nuxt.config: