babel 插件(记得更新哦)

549 阅读1分钟

babel 插件

@babel/plugin-syntax-dynamic-import: Allow parsing of import()

异步引入组件时需要此插件 包含在 @babel/preset-env

const gy = import('@/views/comps/gy.vue')

@babel/plugin-proposal-class-properties:用来解析类的属性的。

@babel/plugin-proposal-object-rest-spread babel/plugin-proposal-object-rest-spread ...的支持 包含在 @babel/preset-env

babel-preset-jsx vue 中的jsx

 "dependencies": {
    "@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
    "@vue/babel-plugin-transform-vue-jsx": "^1.0.0",
    "@vue/babel-sugar-functional-vue": "^1.0.0",
    "@vue/babel-sugar-inject-h": "^1.0.0",
    "@vue/babel-sugar-v-model": "^1.0.0",
    "@vue/babel-sugar-v-on": "^1.0.0"
  },
  
  
  1. functional @vue/babel-sugar-functional-vue - Functional components syntactic sugar
  2. injectH @vue/babel-sugar-inject-h - Automatic h injection syntactic sugar
  3. vModel @vue/babel-sugar-v-model - vModel syntactic sugar
  4. vOn @vue/babel-sugar-v-on - vOn syntactic sugar

@babel/plugin-proposal-optional-chaining

babel.dev/docs/en/bab…

NOTE: This plugin is included in @babel/preset-env 问题: 在vue template 中无法使用(会报错),只能在