search

Home  >  Q&A  >  body text

javascript - Use import to introduce js files in vue, the result is undefined

The file cannot be imported, it is undefined, use require, and the result from the console is the screenshot below


Solution! ! !

phpcn_u1582phpcn_u15822802 days ago2367

reply all(1)I'll reply

  • 学习ing

    学习ing2017-06-10 09:51:15

    The js file exported by import is undefined, that’s because the ec2015 syntax converter is not installed, because ec2015 syntax is not compatible with all browsers
    Installation method: $ npm install --save-dev babel-preset-es2015
    Then create a new one .babelrc file, write:
    {
    presets: ['es2015']
    }
    Just re-npm run dev

    reply
    0
  • Cancelreply