小编Chr*_*bel的帖子

如何解决 Vue SFC 中的“解析错误:此实验性语法需要启用以下解析器插件之一:‘jsx、flow、typescript’”

我在 Vue SFC 模板内使用 eslint 时遇到了这个奇怪的错误。

Parsing error: This experimental syntax requires enabling one of the following parser plugin(s): 'jsx, flow, typescript' (1:0)(这似乎是在 Vue SFC 标签的开始标签上<template>。)

这是 Vue SFC(字面意思是库存 ViteApp.vue文件)

<template>
  <img
    alt="Vue logo"
    src="./assets/logo.png"
  >
  <HelloWorld
    msg="Hello Vue 3 + Vite"
  />
</template>
Run Code Online (Sandbox Code Playgroud)

这是我的.eslintrc文件

module.exports = {
  env: {
    browser: true,
    es2021: true,
  },
  extends: [
    'plugin:vue/essential',
    'airbnb-base',
  ],
  parser: '@babel/eslint-parser',
  parserOptions: {
    ecmaVersion: 12,
    requireConfigFile: false,
    sourceType: 'module',
  },
  plugins: [ …
Run Code Online (Sandbox Code Playgroud)

eslint babeljs

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

babeljs ×1

eslint ×1