Vue cannot detect the component that is provided by my plugin

This unique plugin, currently only includes a single component (coded in TypeScript):

import _Vue, { PluginObject } from "Vue";
import MyComponent from "./MyComponent.vue";

const VuePlugin: PluginObject<void> = {
  install(Vue: typeof _Vue): void {
    Vue.component(MyComponent.name, MyComponent);
    console.log("---");
  }
};

export default VuePlugin;

I anticipate that MyComponent will have global visibility thanks to

Vue.component(MyComponent.name, MyComponent);
.

Instructions for usage:

import Vue from "vue";
import MyPlugin from "my-plugin/VuePlugin";
import RootComponent from "@SourceFiles:StaticView/RootComponent.vue";


(function executeApplication(): void {

  Vue.use(MyPlugin);

  new Vue({
    el: "#Application",
    template: "<RootComponent />",
    components: { RootComponent }
  });
})();
<template lang="pug">
  MyComponent 
    div OK
</template>

<script lang="ts">
  import { Vue, Component } from "vue-property-decorator";

  @Component
  export default class RootComponent extends Vue {}
</script>

The code up until console.log("---"); (within the plugin code) ran smoothly without any issues. However, afterwards, a Vue error was triggered:

Unknown custom element: <DevelopmentBuildAnywherePageVue> - did you register
 the component correctly? For recursive components, make sure to provide the "name" option.

What did I overlook?

Answer №1

There was a mix-up with the component names in this code snippet. Instead of using MyComponent as the component name, the file mistakenly included DevelopmentBuildAnywherePageVue. This caused confusion in the real project. Thanks to @nada for pointing out this error.

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

display does not reflect recent url modification

I am encountering an issue while trying to access different users through my search input. I can type the name of a user, click on their name in the search results, and navigate to their page. The problem arises when I try to view another user after alre ...

The isAuthenticated status of the consumer remains unchanged even after being modified by a function within the AuthContext

I am working on updating the signout button in my navigation bar based on the user's authentication status. I am utilizing React Context to manage the isAuthenticated value. The AuthProvider component is wrapped in both layout.tsx and page.tsx (root f ...

Trouble displaying background image in Electron Application

When I try to load an image file in the same directory as my login.vue component (where the following code is located), it won't display: <div background="benjamin-child-17946.jpg" class="login" style="height:100%;"> A 404 error is popping up: ...

Storing the value of e.currentTarget in a TypeScript variable with a fixed data type

Within my interface, MyObject.type is designated as a type of (constant): 'orange' | 'apple'. However, when attempting to execute: MyObject.type = e.currentTarget.value in the onChange method, an error arises since it could potentially ...

The variable type does not align with the export type

My TypeScript project includes a file that loads environment variables and exports them: const.ts: const { VARIABLE0, // type of VARIABLE0 is string | undefined VARIABLE1, } = process.env; if (!VARIABLE0 || !VARIABLE1) { throw new Error('Inval ...

Using 3 dots argument in Angular 5 to assign values to an array

I stumbled upon this line of code in Angular. Can someone explain its meaning? this.columns = [...this.columns, col]; My guess is that this relates to the immutable concept of arrays. ...

Using Typescript to extract elements from one array and create a new array

I have a set of elements "inputData" , and it appears as follows : [{code:"11" , name= "test1" , state:"active" , flag:"stat"}, {code:"145" , name= "test2" , state:"inactive" , flag:"pass"}, {code1:"785" , name= "test3" , state:"active" , flag:"stat"}, .. ...

Utilizing JavaScript files within Angular2 components: A guide

I need to insert a widget that runs on load. Typically, in a regular HTML page, I would include the script: <script src="rectangleDrawing.js"></script> Then, I would add a div as a placeholder: <div name="rectangle></div> The is ...

Loading game resources in advance for future or immediate utilization

I'm currently developing a game UI that involves a large number of image files, totaling around 30MB in size. I've been caching these images to the disk using service workers, but some of them are quite large at 3MB each. Even when they are retri ...

Creating a Typescript interface where one property is dependent on another property

Let's look at an illustration: type Colors = { light: 'EC3333' | 'E91515' dark: '#100F0F' | '140F0F' } interface Palette { colorType: keyof Colors color: Colors[keyof Colors] } Is it possible for the ...

Issue with rendering images retrieved from JSON data

Struggling with displaying images in my Ionic and Angular pokedex app. The JSON file data service pulls the image paths, but only displays the file path instead of the actual image. Any ideas on what might be causing this issue? Sample snippet from the JS ...

Utilizing objects as values with `react-hook-form`

About the Issue I'm facing an issue with a component that utilizes an object as its value. My goal is to integrate this component with react-hook-form The challenge arises when react-hook-form considers my object as a nested form control Background ...

Tips for properly rendering contenteditable content in Laravel and Vue applications

I have successfully saved the content inside the #descrition section below. <div id="description" contenteditable="true"></div> The issue I am facing is that when I try to display it, it does not show in an HTML format. Instead, it displays e ...

Upgrade your project from Angular 5 to Angular 9 using webpack

I want to share my experience, not ask a question! To upgrade dependencies in package.json: -Update all Angular dependencies to version 9 -Add these dependencies: "@angular-devkit/build-angular": "^0.900.4", "@angular-builders/cu ...

The challenge of maintaining consistency in Vue 3 when it comes to communication between

Context In my Vue 3 application, there is a HomeView component that contains the following template structure: <InputsComponent></InputsComponent> <CheckboxesComponent></CheckboxesComponent> <Toolbar></Toolbar> T ...

What is the best way to integrate properties subsets into your classes?

In my code, I am working with 3 classes ... class1 { constructor(a, b, c) { this.a = a; this.b = b; this.c = c; this.toClass2 = function() { // TODO: return this as an instance of class2; // the conversion would remove the un ...

Issue importing color palettes from JSON into Tailwind CSS

While working on my Vue.js project with Tailwind CSS, I ran into an issue. It seems that Tailwind is not picking up the custom color classes specified in my JSON configuration for 'primary', 'secondary', and 'gray'. Instead of ...

What is the best way to dynamically determine the base path for my templates in Angular 2?

Is it possible to dynamically define the base path of two versions of each template in order to use one or the other through configuration? How can I declare TEMPLATES_PATH so that it can be implemented as shown below: component.ts @Component({ temp ...

Innovative approaches to enhancing Feathers services through the use of relational data in design patterns

I'm in the process of developing a straightforward application that involves a one-to-many relationship between data entities. Specifically, I am working with feathers js and sequelize (utilizing sqlite) to create a system where each site can have mul ...

Is it possible to bind a class using both a variable and a string?

Is there a way to include both a variable and a string as classes in a blade template? <div :class="data['type'] + ' string-class'" v-for="(data, index) in products"></div> Something similar to the example above. ...