在Eslint检查是出现:
error: Parsing error: ImportDeclaration should appear when the mode is ES6 and in the module context a
解决办法:
在 .eslintrc.js 里添加
parserOptions: {
parser: 'babel-eslint',
// ecmaVersion: 'latest',
//把 latest 这里修改一下就好了
ecmaVersion: 12,
sourceType: 'module',
allowImportExportEverywhere: true, // 不限制eslint对import使用位置
ecmaFeatures: {
modules: true,
legacyDecorators: true
}
},