nuxt-export-routes-module
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -7,10 +7,6 @@ import { extractComponentOption } from './utils'; | ||
const nuxtInstance = this; | ||
const jsonRoutesPath = !nuxtInstance.options.dev | ||
? path.resolve(nuxtInstance.options.buildDir, path.join('dist', 'exported-routes.json')) | ||
: null; | ||
const jsonRoutesPath = path.resolve(nuxtInstance.options.buildDir, path.join('dist', 'exported-routes.json')); | ||
let routes = []; | ||
nuxtInstance.extendRoutes((routes) => { | ||
routes = routes.map((route) => { | ||
const savedRoutes = routes.map((route) => { | ||
const options = extractComponentOption(route.component, 'routeOptions'); | ||
@@ -24,5 +20,3 @@ | ||
if (!nuxtInstance.options.dev) { | ||
fs.outputJsonSync(jsonRoutesPath, routes); | ||
} | ||
fs.outputJsonSync(jsonRoutesPath, savedRoutes); | ||
}); | ||
@@ -36,8 +30,4 @@ | ||
if (nuxtInstance.options.dev) { | ||
res.end(JSON.stringify(routes)); | ||
} else { | ||
const savedRoutes = fs.readJsonSync(jsonRoutesPath, { throws: false }); | ||
res.end(JSON.stringify(savedRoutes)); | ||
} | ||
const savedRoutes = fs.readJsonSync(jsonRoutesPath, { throws: false }); | ||
res.end(JSON.stringify(savedRoutes)); | ||
} catch (err) { | ||
@@ -44,0 +34,0 @@ next(err); |
{ | ||
"name": "nuxt-export-routes-module", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Export routes module for Nuxt.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
4562
74