Nuxt.js で yarn run dev で TypeError: Cannot read property 'eslint' of undefined と言われる場合の対処
以下のように nuxt.js を始めようと思った時に
vue init nuxt-community/starter-template my-project cd my-project yarn yarn run dev
http://localhost:3000 にアクセスすると以下のようなエラーが表示される
ERROR in ./.nuxt/client.js Module build failed (from ./node_modules/eslint-loader/index.js): TypeError: Cannot read property 'eslint' of undefined at Object.module.exports (/Users/okamuuu/prj/practice/my-project/node_modules/eslint-loader/index.js:148:18)
どうやら nuxt.config.js の isClient が deprecated として前から警告されており、使用できなくなったようです。
https://github.com/nuxt/nuxt.js/issues/2527
という事で以下のように修正しましょう。
- extend (config, { isDev, isClient }) { - if (isDev && isClient) { + extend (config, { isDev }) { + if (isDev && process.client) {
めでたし。