nuxt项目启动禁止eslint
要禁止 Nuxt 项目启动时执行 ESlint,可以在项目根目录下的 nuxt.config.js 文件中进行一些配置。
首先,找到 build 配置项,在其中添加 extend(config, ctx) {},如下所示:
build: {
extend(config, ctx) {}
}
然后,在 extend 方法中添加以下代码来禁用 ESlint:
build: {
extend(config, ctx) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
这将向 Webpack 配置中添加一个新的规则,用于处理 .js 和 .vue 文件,并排除 node_modules 目录。由于没有指定任何加载器,因此 ESlint 将不会被执行。
保存配置文件后,重新启动 Nuxt 项目,ESlint 将不再执行。
原文地址: https://www.cveoy.top/t/topic/i10d 著作权归作者所有。请勿转载和采集!