d3xter-dev / sitemap-module-nuxt-3

Sitemap Module for Nuxt 3
https://sitemap.nuxtjs.org
MIT License
63 stars 12 forks source link

nuxt 3.0.0-rc.12 [h3] Implicit event handler conversion is deprecated. #8

Closed sotnikovse closed 2 years ago

sotnikovse commented 2 years ago
Nuxi 3.0.0-rc.12
dev: Nuxt 3.0.0-rc.12 with Nitro 0.6.0
dev: 
dev:   > Local:    http://localhost:3000/ 
dev:   > Network:  http://192.168.1.5:3000/
dev: 
dev: ✔ Nitro built in 1009 ms
dev: [h3] Implicit event handler conversion is deprecated. Use `eventHandler()` or `fromNodeMiddleware()` to define event handlers. 
dev:      Route: /sitemap.xml 
dev:      Handler: async (event) => {
dev:   const runtimeConfig = useRuntimeConfig();
dev:   const res = event.res;
dev:   const req = event.req;
dev: 
dev:   const require = createRequire(globalThis._importMeta_.url);
dev:   if (!require) {
dev:     console.log('cant use require in middleware');
dev:   }
dev:   // eslint-disable-next-line no-new-func,no-eval
dev:   const options = eval(' (' + runtimeConfig.sitemap.options + ')')[event.url];
dev:   const staticRoutes = runtimeConfig.sitemap.staticRoutes;
dev: 
dev:   // Init cache
dev:   if (!globalCache.staticRoutes) {
dev:     globalCache.staticRoutes = () => excludeRoutes(options.exclude, staticRoutes);
dev:     globalCache.routes = createRoutesCache(globalCache, options);
dev:   }
dev: 
dev:   try {
dev:     // Init sitemap
dev:     const routes = await globalCache.routes.get('routes');
dev:     const xml = createSitemap(options, routes, options.base, req).toXML();
dev:     // Check cache headers
dev:     if (validHttpCache(xml, options.etag, req, res)) {
dev:       return
dev:     }
dev:     // Send http response
dev:     res.setHeader('Content-Type', 'application/xml');
dev:     res.end(xml);
dev:   } catch (err) {
dev:     /* istanbul ignore next */
dev:     return err
dev:   }
dev: }
dev: ℹ Vite client warmed up in 35036ms

/sitemap.xml 500 Cannot read properties of undefined (reading 'cacheTime')

d3xter-dev commented 2 years ago

@5cube Thank you for contributing :) I released version 4.0.0 with your changes!