Cannot load *.ts files as part of Vuex store
See original GitHub issueDescribe 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:
- Set up a new nuxt+ts project using
create-nuxt-app
- Create some store modules in
*.ts
files (even used the one from the docs). - See the module not being loaded (not in the template, not in devtools)
- 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:
- Created 3 years ago
- Comments:8
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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! 😃
@afontcu Yep, if you move files to
src
you need to tweaksrcDir
in Nuxt configuration so Nuxt correctly finds the files