Arn*_*ugo 9 es6-modules prettier
我在 中定义了一个更漂亮的配置prettier.config.js。
"type": "module"添加到 package.json后(以启用在节点中使用导入/导出语法),运行 prettier 失败并出现以下错误:
Checking formatting...
[error] Invalid configuration file `prettier.config.js`: Must use import to load ES Module: /your/project/path/prettier.config.js
[error] require() of ES modules is not supported.
[error] require() of /your/project/path/prettier.config.js from /your/project/path/node_modules/prettier/third-party.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.
[error] Instead rename prettier.config.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /your/project/path/package.json.
[error]
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Run Code Online (Sandbox Code Playgroud)
我将 SublimeText 3 与JSPrettier一起使用,它也停止工作,因为 prettier 不起作用。
| 归档时间: |
|
| 查看次数: |
9342 次 |
| 最近记录: |