Oops! We encountered an issue with this dependency being missing - TypeScript and Vue

Just starting out with TS and Vue.

Encountering this error message while attempting to run vue-cli-service serve:

This dependency was not found:

  * @store in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/ts-loader??ref--12-1!./node_modules/vue-loader/lib??vue-loader-opt
ions!./src/components/HelloWorld.vue?vue&type=script&lang=ts&

To install it, you can run: npm install --save @store

Found in ./src/components/HelloWorld.vue :

import { RootState, storeBuilder, CustomerStore } from '@store';

In tsconfig.json :

"baseUrl": "./src",
"paths": {
  "@/*": ["src/*"],
  "store": ["./store/index.ts"], 

Switching the import statement like below resolves the error.

import { RootState, storeBuilder, CustomerStore } from './../store';

Do I need any additional configuration or package? My setup:

- vue 3.0.1
- tsc 3.0.3

Answer №1

'@shop';

ought to be

'@/store';

Answer №2

After some exploration, I managed to find a solution where I could easily import using '@store';

I made changes to the vue.config.js file by adding the following:

const path = require('path');
const ROOT = path.resolve(__dirname);

function root(args) {
  args = Array.prototype.slice.call(arguments, 0);
  return path.join.apply(path, [ROOT].concat(args));
}

module.exports = {
      configureWebpack: config => {
        config.resolve = {
          extensions: ['.js', '.ts'],
          alias: {
            '@store': root('src/store/index.ts'),
          },
        };
      }
    }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unlocking the Power of Custom Fontawesome Icons in Ionic3 ActionSheet

I've been struggling with incorporating custom Fontawesome icons into my ActionSheet buttons in Ionic3. Previously, I was able to use code like this: <i class="fas fa-ad"></i> within the title/text property of the actionsheet button to d ...

TS2339: The 'contacts' property is not found within the 'Navigator' type

I am currently developing a contacts application that utilizes the Apache Cordova plugins for contacts. However, when attempting to run the npm run bundle command for my application, I encountered the error mentioned in the title above. Can anyone guide me ...

Tips for efficiently awaiting outcomes from numerous asynchronous procedures enclosed within a for loop?

I am currently working on a search algorithm that goes through 3 different databases and displays the results. The basic structure of the code is as follows: for(type in ["player", "team", "event"]){ this.searchService.getSearchResult(type).toPromise ...

How can I emphasize the React Material UI TextField "Cell" within a React Material UI Table?

Currently, I am working on a project using React Material UI along with TypeScript. In one part of the application, there is a Material UI Table that includes a column of Material TextFields in each row. The goal is to highlight the entire table cell when ...

What is the best way to delete markers from a leaflet map?

I need to remove markers from my map. I am looking to create a function that will specifically clear a marker based on its ID. I am utilizing Leaflet for the map implementation. Here is my function: public clearMarkers(): void { for (var id in this. ...

Is there a way for me to create a task filter based on its name?

<template lang="pug"> .kanban .statuses .todo(@drop="onDrop($event,'todo')" @dragenter.prevent @dragover.prevent) span To do tasks-order-by-status(:tasks = 'taskTodo') .inprogres ...

retrieve a shared string from an array when toggled

Regarding the use of SelectionModel for mat-checkbox, a function is called on each click: toggleSelection(row) { this.selection.toggle(row); console.log("Selection"); console.log("this", this.selection.selected); this.selection.selected.f ...

Typescript erroneously raises an issue indicating that the condition is expected to always be

Consider the code snippet below: class A { private foo : number = 3; public method () { if (this.foo === 3) { this.anotherMethod(); if (this.foo === 4) { console.log(this.foo); } ...

Entering the appropriate value into an object's property accurately

I am currently facing an issue with typing the value needed to be inserted into an object's property. Please refer below. interface SliceStateType { TrptLimit: number; TrptOffset: number; someString: string; someBool:boolean; } inter ...

How can I integrate a timer into an Angular carousel feature?

I have put together a carousel based on a tutorial I found on a website. Check out the HTML code for my carousel below: <div class="row carousel" (mouseover)="mouseCheck()"> <!-- For the prev control button ...

Setting up electron with vuejs and tailwindcss: a step-by-step guide

Setting up a project from the ground up using these particular technologies has proven to be a challenge for me. I'm curious if it's possible to integrate nuxtjs with electronjs. electronjs vuejs tailwindcss ...

The Map<> type does not seem to offer autofill suggestions for union arrays

Can anyone explain why TypeScript isn't providing autofill suggestions for "foo" or "bar" when typing elements into an empty array in the code snippet below? const map: Map<string, ('foo' | 'bar')[]> = new Map([ ['hell ...

Verifying the existence of an optional property on my component using Jest

One of the props in my component is called jsonpayload, and it is optional. Here's how it looks in the interface: export interface props { jsonpayload?: payload[] onclick: () => void; } My Jest file: const test_prop: dummy_props ...

Storing application state using rxjs observables in an Angular application

I'm looking to implement user status storage in an Angular service. Here is the code snippet I currently have: import { Injectable } from '@angular/core'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; @Injectable() expo ...

What Google Domain Verification APIs are needed for verifying domains in Pub/Sub?

I've written this code that utilizes a Domain token to verify a domain with Google using the Site Verification API: const auth = await this.gcp.getApplicationCredential(accountId, projectId,[ 'https://www.googleapis.com/auth/siteverification ...

`Angular RxJS vs Vue Reactivity: Best practices for managing UI updates that rely on timers`

How can you implement a loading spinner following an HTTP request, or any asynchronous operation that occurs over time, using the specified logic? Wait for X seconds (100ms) and display nothing. If the data arrives within X seconds (100ms), display i ...

Is it better to keep a lengthy array in the back-end or front-end storage?

I'm facing a dilemma in my angular application. I have a lengthy array that I need to access easily from the front-end without causing any slowdowns. There are various options available, but I'm unsure which one would be the most efficient. Shoul ...

Callback for dispatching a union type

I am currently in the process of developing a versatile function that will be used for creating callback actions. However, I am facing some uncertainty on how to handle union types in this particular scenario. The function is designed to take a type as inp ...

Arranging arrays of various types in typescript

I need help sorting parameters in my TypeScript model. Here is a snippet of my model: export class DataModel { ID: String point1: Point point2 : Point point3: Point AnotherPoint1: AnotherPoint[] AnotherPoint2: AnotherPoint[] AnotherPoi ...

Building custom queries in ReactQuery with Typescript is a powerful tool for

Currently, I am in the process of creating a simplified query builder for my react query requests, but I am facing challenges with TypeScript. My proficiency in TS is not great as I am still learning. I am attempting to incorporate the latest insights fro ...