1.3.1 • Published 7 months ago

nuxt-error-and-cache v1.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Nuxt Module

  1. 收集运行时错误信息
  2. 服务端生成 html 缓存
  3. 清除单独链接 lrucache(url?nocache=true)
  4. 清除所有 lru-cache(url?nocache=all)

使用方式

// nuxt.config.js

import { defineNuxtConfig } from 'nuxt/config'

export default defineNuxtConfig({
  modules: ['nuxt-error-and-cache'],
  errorCacheConfig: {
    production: process.env.NODE_ENV === 'production',
    /**
     * cache: boolean |
     * {
        lru?: Partial<LRUCache<string, { html: string }>>
        routes?: Record<string, unknown>,
        excludeDir?: string[]
        excludePath?: string[]
     * }
     */
    cache: {
      /**
       * 默认生产环境添加缓存
       * 生效会在html-response header写入res.setHeader('server-cache-times', timer)
       */
      /**
       * lru-cache参数配置
       * 默认
       *  max: 5000,
       * ttl: 1000 * 60 * 5,  默认根据ttl/(1000*60)缓存5分钟
       * allowStale: true
       */
      lru: {},
      // 设置路由在服务器缓存时间-min
      // 默认5分钟
      routes: {
        '/aaa': 3
      },
      /**
       * 排除的url地址、server端请求url(./server/api)
       */
      excludePath: ['/api/nuxt/write-404', '/api/*']
    },
    /**
     * 是否采集运行时错误
     * default: true
     * 采集内容-报错内容\报错时间\报错页面\报错位置\userAgent
     * 项目目录下需要有logs文件夹-错误信息会写入该目录
     * prefix: 文件前缀_YYYYMM.log
     * path: './logs' 相对路径
     */
    collect: {}
  }
})

Development

  • Run npm run dev:prepare to generate type stubs.
  • Use npm run dev to start playground in development mode.
1.3.1

7 months ago

1.3.0

7 months ago

1.2.0

7 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.1.2

9 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2-alpha.0

2 years ago

1.0.0

2 years ago

0.0.2-alpha.9

2 years ago

0.0.2-alpha.8

2 years ago

0.0.2-alpha.7

2 years ago

0.0.2-alpha.6

2 years ago

0.0.2-alpha.5

2 years ago

0.0.2-alpha.4

2 years ago

0.0.2-alpha.3

2 years ago

0.0.2-alpha.2

2 years ago

0.0.2-alpha.1

2 years ago

0.0.2-alpha.0

2 years ago

0.0.1

2 years ago