Typescript: Additional Extensions not filled by @nuxt/typescript-build

Created on 17 Oct 2019  路  6Comments  路  Source: nuxt/typescript

Version

v2.10.1

Reproduction link

https://toomuchwork.com

Steps to reproduce

What is expected ?

additionalExtensions should be ['ts', 'tsx']

What is actually happening?

additionalExtensions is []

This bug report is available on Nuxt community (#c9924)
documentation transfered programmatic usage

Most helpful comment

@b-m-f I think it's related to https://github.com/nuxt/typescript/issues/139 request, i'd say new Guide section about Programmatic usage

All 6 comments

@b-m-f You need to do await nuxt.ready() AFAIK so it properly setup the module (it will call the module container that is responsible to register modules).
Without doing it it will trigger the build without having called @nuxt/typescript-build so you won't have additionalExtensions properly set.

Alternatively, you can also register the TS @nuxt/typescript-build module this way : https://github.com/nuxt/typescript/blob/master/packages/typescript-build/test/module.test.ts#L36

Thanks. Will try it out on wednesday when I am back on the codebase. Seems like this will likely be the culprit! It did smell like an Synchronization problem :)

@kevinmarrec This was indeed the problem. Is there a place I could add some documentation for this?

@b-m-f I think it's related to https://github.com/nuxt/typescript/issues/139 request, i'd say new Guide section about Programmatic usage

Ok, so took me like an hour to figure out why middleware wasn't picking up .ts files until I stumbled upon this issue.

Current solution for me is to add additionalExtensions: ['ts'] in the nuxt.config.js build object.

I think the default option should include .ts files.

BTW: I'm using Nuxt programmatically.

Closed by #233

Was this page helpful?
0 / 5 - 0 ratings