React SyntaxError:无法在模块外部使用import语句

时间:2020-07-01 19:10:14

标签: reactjs import datepicker

我目前正在尝试使用Formik提供的“ react-formik-ui” Datepicker。它工作得很好,但是当我使用npm run test时,它会通过我的测试,然后因以下错误而失败:

 SyntaxError: Cannot use import statement outside a module

       7 | import states from 'helpers/selectOptions/StatesProvinces'
       8 | import { connect } from 'react-redux'
    >  9 | import { Datepicker } from 'react-formik-ui'
         | ^
      10 |
      11 |
      12 | class BuildFormLoad extends React.Component {

这里是进口图片

enter image description here

我已经尝试了一切,但终生无法找出需要更改的内容。我将导入与其他文件一起使用,甚至与此文件一起使用,它们也可以正常工作。它似乎仅与“ react-formik-ui”一起使用。任何帮助表示赞赏。

0 个答案:

没有答案