問題
在开发nuxt过程遇到了报错,希望大家下次遇到的时候可以迅速解决 报错信息如下
Module build failed (from ./node_modules/eslint-loader/index.js):
ここで、eslintに問題があることがわかります。そのため、プロジェクトでnuxt.config.jsを見つけ、eslint-loaderが割り当てられている場所に移動する
と、元のコードは次のようになります。
build: {
/*
** Run ESLINT on save
*/
extend (config, ctx) {
if (ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
}
isClientが削除されたため、Clientを使用する必要があります。次のコードを使用してください。
build: {
/*
** Run ESLINT on save
*/
extend (config, ctx) {
if (ctx.Client) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
}
npm run devをもう一度実行して、問題を完全に解決します。ご覧いただきありがとうございます。
皆さんが遭遇した問題を解決できることを願っています