babel.js 530 B

123456789101112131415161718192021
  1. module.exports = cli => {
  2. cli.injectFeature({
  3. name: 'Babel',
  4. value: 'babel',
  5. short: 'Babel',
  6. description: 'Transpile modern JavaScript to older versions (for compatibility)',
  7. link: 'https://babeljs.io/',
  8. checked: true
  9. })
  10. cli.onPromptComplete((answers, options) => {
  11. if (answers.features.includes('ts')) {
  12. if (!answers.useTsWithBabel) {
  13. return
  14. }
  15. } else if (!answers.features.includes('babel')) {
  16. return
  17. }
  18. options.plugins['@vue/cli-plugin-babel'] = {}
  19. })
  20. }