相关疑难解决方法(0)

ESLint - 错误:必须使用导入来加载 ES 模块

我目前正在使用 React、TypeScript、样式组件、 Webpack等设置样板,在尝试运行ESLint时遇到错误:

\n
\n

错误:必须使用 import 来加载 ES 模块

\n
\n

这是错误的更详细版本:

\n
/Users/ben/Desktop/development projects/react-boilerplate-styled-context/src/api/api.ts\n  0:0  error  Parsing error: Must use import to load ES Module: /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js\nrequire() of ES modules is not supported.\nrequire() of /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/eslint/node_modules/eslint-scope/lib/definition.js from /Users/ben/Desktop/development projects/react-boilerplate-styled-context/node_modules/babel-eslint/lib/require-from-eslint.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.\nInstead rename definition.js to end in .cjs, …
Run Code Online (Sandbox Code Playgroud)

javascript node.js reactjs eslint

198
推荐指数
2
解决办法
16万
查看次数

标签 统计

eslint ×1

javascript ×1

node.js ×1

reactjs ×1