Home

Issue: 2310

Putting a .ts file in middleware/ leads to death

[issue link]

nuxt version: 1.0.0-gh-704e7cd
If you put a .ts file in middleware/ while nuxt dev is running, everything is fine.
Furthermore, this file is actually compiled as typescript and can be required on pages through the middleware property.

However, if you stop the process and try to run nuxt dev again, you will get the most peculiar error:
(only) page-level components (only) with <script lang="ts"> will produce the following error:

  ERROR  Failed to compile with 1 error

 error  in ./pages/check.vueerror  in ./pages/test.vue

Module build failed: Error: Could not find file: '/test/pages/test.vue'.
    at getValidSourceFile (/test/nod
e_modules/typescript/lib/typescript.js:95642:23)

This happens for any .ts file in middleware and any <script lang="ts"> in a page, even if the middleware is empty and unused and the script tag is empty.

This question is available on Nuxt.js community (#c2017)