JS.VUE.PREFER.IMPORT.FROM.VUE

Wrong import from `'@vue/*'`. use imports from `'vue'` instead

Rule Details

This rule aims to use imports from 'vue' instead of imports from '@vue/*'.

Imports from the following modules are almost always wrong. You should import from vue instead.

  • @vue/runtime-dom
  • @vue/runtime-core
  • @vue/reactivity
  • @vue/shared

{'vue/prefer-import-from-vue': ['error']}" filename="example.js" language="javascript

Copy
/* GOOD */
import { createApp, ref, Component } from 'vue'

{'vue/prefer-import-from-vue': ['error']}" filename="example.js" language="javascript

Copy
/* BAD */
import { createApp } from '@vue/runtime-dom'
import { Component } from '@vue/runtime-core'
import { ref } from '@vue/reactivity'

Options

Nothing.

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/