[英]NuxtJS ignore webpack/chokidar watchers for specific file or folder
I'm using NuxtJS' serverMiddleware for logging.我正在使用 NuxtJS 的 serverMiddleware 进行日志记录。 It works on every route.它适用于每条路线。
import { logger } from './utils/logger';
module.exports = function(req, res, next){
logger.info('log.js');
next();
}
It works fine, but when im working on dev environment, whenever I navigate some page, it logs some data, Nuxt dev server logs to console: Updated logs/server.log and then rebuilds dev server.它工作正常,但是当我在开发环境中工作时,每当我浏览某个页面时,它都会记录一些数据,Nuxt 开发服务器将日志记录到控制台:更新日志/server.log,然后重建开发服务器。
I need to extract them from watching list.我需要从观看列表中提取它们。
I've configured watchers property on nuxt.config.js ( according to this page: https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-watchers ) :我已经在 nuxt.config.js 上配置了 watchers 属性(根据这个页面: https ://nuxtjs.org/docs/2.x/configuration-glossary/configuration-watchers):
watchers: {
chokidar: {
ignored: '/logs/server.log'
},
webpack: {
ignored: '/logs/server.log'
}
},
but unfortunately it doesn't work.但不幸的是它不起作用。
Thank you for your interest!感谢您的关注!
Edit编辑
I've tried adding files to .nuxtignore file.我试过将文件添加到.nuxtignore文件。 But it doesn't work as well.但它也不起作用。
you could create a .nuxtignore
file and add your file to it.您可以创建一个.nuxtignore
文件并将您的文件添加到其中。 I think this will help ignoring it all the way down.我认为这将有助于一直忽略它。
More info here: https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-ignore#nuxtignore更多信息: https : //nuxtjs.org/docs/2.x/configuration-glossary/configuration-ignore#nuxtignore
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.