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.

Cannot load *.ts files as part of Vuex store

See original GitHub issue

Describe the bug A nuxt project with @nuxt/typescript-build doesn’t seem to load *.ts files in /store.

To Reproduce Steps to reproduce the behavior:

  1. Set up a new nuxt+ts project using create-nuxt-app
  2. Create some store modules in *.ts files (even used the one from the docs).
  3. See the module not being loaded (not in the template, not in devtools)
  4. Change the file extension to *.js. Then, the file gets properly loaded.

Expected behavior Nuxt to autoload store modules in *.ts files.

Additional context I gave #219 suggestions a go with no success.

Happy to provide additional context if needed 😃

Thank you! 🤗

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
afontcucommented, Mar 24, 2020

Okay, got it working by leveraging internal nuxt alias config (@@ === rootDir). Anyway, closing this since this is clearly not a bug related to nuxt-typescript.

Thanks for your help though! 😃

1reaction
kevinmarreccommented, Mar 24, 2020

@afontcu Yep, if you move files to src you need to tweak srcDir in Nuxt configuration so Nuxt correctly finds the files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Accessing Vuex store in router.ts file - typescript - Stack Overflow
$store but not working in . ts files. import Vue from 'vue'; import Vuex from 'vuex'; Vue. use(Vuex); export default new Vuex.
Read more >
Use a Vuex Store with Typing in TypeScript - ITNEXT
I found a way to use Vuex stores in TypeScript without losing typing. It doesn't require classes, so it is compatible with Vue...
Read more >
TypeScript Support - Vuex
Vuex provides its typings so you can use TypeScript to write a store definition. You don't need any special TypeScript configuration for Vuex....
Read more >
ts-loader - npm
Loading css and other resources is possible but you will need to make sure that you have defined the require function in a...
Read more >
Common TypeScript module problems and how to solve them
ts . This time, the file does not exist, so the compiler will substitute 'nav/file3' with the second location " ...
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