Error encountered in Vue code, lacks default export on Editor Terminal

I'm not experiencing any issues in the browser, I am getting the desired output. However, why does this keep showing up in the editor terminal?

Any assistance would be greatly appreciated.

Error - No Default Export:

The module "/vue3/src/components/TestIcon.vue" does not have a default export.

This is how my component looks:

TestIcon.vue

<template>
  <span v-html="svg" class="icon-wrapper" ref="iconWrapper"></span>
</template>    
<script setup lang="ts">
import type { tycon } from "test-icons";
import { computed, onMounted, ref } from "vue";
import { completeDataSet } from "test-icons";

const props = defineProps<{
  icon: tycon;
  class: string;
  color: string;
  height: string;
  width: string;
}>();
const iconPassed = completeDataSet.find((item) => item.name === props.icon);

const svg = computed(() => iconPassed?.data);

const iconWrapper = ref<HTMLElement | null>(null);

onMounted(() => {
  iconWrapper.value?.lastElementChild?.firstElementChild?.setAttribute(
    "class",
    props.class
  );

  iconWrapper.value?.firstElementChild?.setAttribute(
    "style",
    "width:" + props.width + "px;height:" + props.height + "px;"
  );

  iconWrapper.value?.firstElementChild?.firstElementChild?.setAttribute(
    "fill",
    props.color
  );
});
</script>

App.vue:

<template>
  <main>
    <TestIcon :icon="'icon_test'" :class="'tests'" :height="40" :width="40" />
  </main>
</template>
<script lang="ts">
import TestIcon from "@/components/TestIcon.vue";
export default {
  components: {
    TestIcon,
  }
};
</script>

Answer №1

If you happen to be utilizing vue-cli, make sure to check for the existence of a file named shims-vue.d.ts with the following content:

/* eslint-disable */
declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}

Alternatively, if you are using vite, review the env.d.ts file which should contain:

/// <reference types="vite/client" />

/* eslint-disable */
declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}

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

Show a message of 'no results found' when implementing a jQuery plugin for filtering items in a list

I recently implemented the 'Filtering Blocks' tutorial from CSS-Tricks to filter items by category on an events website I'm developing. While the filtering functionality works perfectly, I realized that there is no mechanism in place to sho ...

Exploring the functionalities of AngularJS' ng-options when working with select elements

In my search through other posts, I came across this issue but couldn't find a solution. Here is the array in question: $scope.items = [ {ID: '000001', Title: 'Chicago'}, {ID: '000002', Title: 'New York' ...

Whenever I try to include something within the `componentWillUnmount` function,

I'm currently learning React on my own. I've been trying to save session data in my componentWillUnmount method. However, when I add code inside componentWillUnmount, nothing seems to happen. I tried debugging by adding console logs and debugger ...

Exploring the magic of Hover effects using CSS and JQuery

I am exploring ways to enhance the display of an element when hovering over it. I have implemented a button and my objective is for the first click to activate the hover effect, while the second click will reset it. However, I am facing an issue where the ...

Pause jQuery at the conclusion and head back to the beginning

As a beginner in the world of jQuery, I am eager to create a slider for my website. My goal is to design a slideshow that can loop infinitely with simplicity. Should I manually count the number of <li> elements or images, calculate their width, and ...

Auto play feature malfunctioning in Onsen-UI Carousel attribute settings

When utilizing onsen UI in my mobile web application, I encountered an issue with the autoplay property not functioning properly within the carousel. <ons-page> <ons-toolbar> <div class="left"> <ons-toolbar-button on ...

Why is my Ajax utilizing PHP _POST not functioning as expected?

I am facing an issue with the JavaScript code below: <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js'></script> <script> function deletUserInfo(id_user){ console.log(id_user); ...

I am encountering an issue with my Laravel Vue application where it is not able to delete a record. Should I consider binding my button to ensure it redirects to the controller

Hello, I am facing an issue while working on my app that involves a simple CRUD operation. The problem is that the code does not delete a record when I click the delete button. I am new to Laravel and Vue, so I am still getting familiar with how these two ...

Angular: Clicking on a component triggers the reinitialization of all instances of that particular component

Imagine a page filled with project cards, each equipped with a favorite button. Clicking the button will mark the project as a favorite and change the icon accordingly. The issue arises when clicking on the favorite button causes all project cards to rese ...

What is the best way to split an array into four columns and allocate 10 <li> items from the array to each column?

If I have a dynamic array with 40 elements that changes on every render, how can I loop through the array and return 4 groups of elements, each containing 10 items without any repetition? I want to style these objects in the array using a parent flex con ...

Exploring the parent-child relationship of three components within Angular 2

Currently, I am developing a shopping cart using Angular 2. The application consists of two components - one for categories and another for product listings, both included in the main app component as children. However, I'm facing an issue where these ...

Challenges with Typescript arise when modifying dependencies within a Firebase function, leading to compilation

Recently, I decided to update the dependencies of my Firebase functions project in order to utilize newer versions of firebase-functions and firebase-admin. However, this led to a requirement for more recent versions of TypeScript and tslint. After making ...

What is the best way to access an external array using ng-repeat in AngularJS?

My dataset consists of 3 separate arrays. "areas": { "default": [ { "area": "Master Bedroom", "uuid": "986e3f42-1797-49ae-b060-181a33b9", "description": "", "new": [ { "value": "986e3f42-1797-49ae-b060-181a3 ...

Can anyone provide guidance on setting up a TypeScript service worker in Vue 3 using the vite-plugin-pwa extension?

I am looking to develop a single-page application that can be accessed offline. To achieve this, I have decided to implement a PWA Service Worker in my Vue webapp using TypeScript and Workbox. I found useful examples and guidance on how to do this at . Ho ...

How can you programmatically deselect all checkboxes in a list using React hooks?

I am facing a challenge with my list of 6 items that have checkboxes associated with them. Let's say I have chosen 4 checkboxes out of the 6 available. Now, I need assistance with creating a button click functionality that will uncheck all those 4 sel ...

What are the steps to create a one-way binding between multiple input fields and a master input in Vue3?

In my scenario, there exists a primary HTML <input> element: <template> <input id="tax_master" max="100" min="0" type="number" v-model="taxDefault" /> </template ...

Creating dynamically generated nested text inputs with individual v-model bindings upon the clicking of a button

As a newcomer to vuejs, I am attempting to create nested textboxes dynamically with the click of a button. For a clearer explanation, please refer to this jsfiddle link: https://jsfiddle.net/avi_02/qLqvbjvx/ Let's use an analogy to grasp the iss ...

Price Adjuster Tracker

Recently, I coded a small JavaScript program with the purpose of: incrementing or decrementing the quantity of an item by 1 adjusting the price of an item based on the initial price However, my excitement turned to disappointment when I encountered these ...

Changing the global type in TypeScript

Currently, I am incorporating two third-party TypeScript libraries into my project. Interestingly, both of these libraries expose a global variable with the same name through the Window interface. However, they offer different methods for interacting with ...

An informative step-by-step approach to constructing Angular applications utilizing npm and TypeScript

When I first encountered Angular2, I was introduced to TypeScript, npm, and more for the very first time. I was amazed by their power, but I know I've only scratched the surface. While I can navigate through the "development mode," my ultimate goal i ...