Vue 3 – “Failed to resolve component” with global components

Registering components in the root component’s components option doesn’t make them global. Doing that just makes them available to the root component itself, not its children. To register components globally, use app.component in your top-level code: main.js import { createApp } from ‘vue’; import App from ‘./App.vue’; import MyGlobalComponent from ‘./components/MyGlobalComponent.vue’; const app = createApp(App); … Read more

How to configure Vue CLI 4 with ESLint + Airbnb rules + TypeScript + Stylelint for SCSS, in VS Code editor with autofix on save?

Official scaffolded Vue CLI project’s configurations After Vue CLI 4.2 upgrades in create project scaffolding in February 2020, you are half way through the configurations by creating a new project with global vue create myproject command and making at least these selections (configurations included below): Vue CLI v4.2.2 ? Please pick a preset: Manually select … Read more

use axios globally in all my components vue

In main.js you can just assign Axios to $http. main.js import Axios from ‘axios’ Vue.prototype.$http = Axios; By modifying the vue prototype, any vue instance will have the ability to call $http on this. (e.g. this.$http.get(‘https://httpbin.org/get’) Note: $http is the axios object now, so any method you can call on axios object, you can call … Read more

vue cli 3 – use background image in style tag

As Max Martynov, highlighted in the comments, you should use url(‘~@/assets/image.svg’).   Webpack has some specific rules when resolving assets[1]. In order to resolve an alias (@), as you are using, it is mandatory webpack handles the request as a module request. Using the prefix ~ enforces webpack to treat the request as a module … Read more

tech