Babel unexpected token import when running mocha tests

前端 未结 17 1504
Happy的楠姐
Happy的楠姐 2020-11-27 14:40

The solutions offered in other related questions, such as including the proper presets (es2015) in .babelrc, are already implemented in my project.

I have two projec

17条回答
  •  情歌与酒
    2020-11-27 15:02

    You might need to specify the extensions option if you're using TypeScript:

    require("@babel/register")({
      extensions: ['.jsx', '.js', '.ts', '.tsx']
    })
    

提交回复
热议问题