JavaScriptのbabel-eslintで「error Parsing error: require() of ES Module」
今回はJSを使用しているときに下記のようなエラーが起きたときの対処法についてご紹介していきます。
| 1 2 3 | /usr/local/test/index.vue   0:0  error  Parsing error: require() of ES Module /usr/local/test/node_modules/eslint-scope/lib/definition.js from /usr/local/test/node_modules/babel-eslint/lib/require-from-eslint.js not supported. Instead change the require of definition.js in /usr/local/test/node_modules/babel-eslint/lib/require-from-eslint.js to a dynamic import() which is available in all CommonJS modules | 
JavaScriptのbabel-eslintで「error Parsing error: require() of ES Module」
私の場合は、babel-eslintを使おうとしているときに表題のエラーが発生しました。
表題のエラーが起こる原因の可能性としては、2024年10月現在、babel-eslintはすでにメンテナンスされていないため、代わりに@babel/eslint-parserを使用することが推奨されているという状況が関連していると思われます。
私の場合、babel-eslintをアンインストールして@babel/eslint-parserをインストールすると表題のエラーが解決しました。
みなさんもぜひお試しください。
終わりに
今回はJSを使用しているときに表題のようなエラーが起きたときの対処法についてご紹介いたしました。








ディスカッション
コメント一覧
まだ、コメントがありません