-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
docsify-server-renderer error #704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
My work dir:
|
// src/server/router/docs.js
require('colors')
const path = require('path')
const send = require('koa-send')
const renderer = require('../controller/docs-renderer')
const docsDir = path.resolve(__dirname, '../../docs')
const routerName = 'docs'
const routerPath = '/docs/(.*)?'
const routerHandler = async ctx => {
const sendPath = ctx.path.replace(`/${routerName}`, '') || '/'
const sendOptions = {
root: docsDir,
index: 'index.html'
}
try {
await send(ctx, sendPath, sendOptions)
} catch (e) {
console.log(`[${'send'.magenta} ${'404'.red}] ${ctx.path}`)
}
}
module.exports = {
name: routerName,
path: routerPath,
handler: routerHandler
} |
When i visit http://localhost:3333/docs#/, it's all OK with router model hash. But if i try ssr, there is allways a error of parse. Pls see: docsify/src/core/render/compiler.js Line 121 in a257a4a
The method |
I have the same problem
|
I've the exact same error. I'm trying to use docsify with SSR using docsify-server-renderer but seems impossible. Also, the documentation talks about a renderer.renderToString(url) but it's not explained what the "url" parameter should be. @QingWei-Li Can you take a look, please? |
Has anyone been able to identify which was the last working version of docsify? |
About // line 346-360
AbstractHistory.prototype.parse = function parse (path$$1) {
var query = '';
var queryIndex = path$$1.indexOf('?');
if (queryIndex >= 0) {
query = path$$1.slice(queryIndex + 1);
path$$1 = path$$1.slice(0, queryIndex);
}
return {
path: path$$1,
file: this.getFile(path$$1),
query: parseQuery(query)
}
}; by ... (around line 349) // line 346-360
AbstractHistory.prototype.parse = function parse (path$$1) {
var query = '';
var queryIndex = -1; // new
if (path$$1) queryIndex = path$$1.indexOf('?'); // edited
if (queryIndex >= 0) {
query = path$$1.slice(queryIndex + 1);
path$$1 = path$$1.slice(0, queryIndex);
}
return {
path: path$$1,
file: this.getFile(path$$1),
query: parseQuery(query)
}
}; It works apparently or simply avoid the error. But I got another situation, may be with the |
Same error! Just download https://github.com/docsifyjs/docsify-ssr-demo
|
just download
|
All works with old 4.1.7 version.
Last version 4.3.0 returns error |
No. Something wrong.. Can you update docsify-cli or ssr example repo, pls? |
i'm having the same issue... anyone have any luck? |
It seems that the examples on docsify-ssr-demo are incomplete and incorrect. I don't know how https://docsify.now.sh/ssr is implemented. git clone https://github.com/docsifyjs/docsify-ssr-demo
cd docsify-ssr-demo
npm i
npm start
# open http://localhost:4000
# TypeError: Cannot read property 'indexOf' of undefined git clone https://github.com/docsifyjs/docsify
cd docsify
npm i
npm run dev:ssr
# open http://localhost:3000
# UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'indexOf' of undefined |
The same error found, even upgrade to the latest version of docsify |
The same error found, even upgrade to the latest version of docsify 4.3 |
Same here, any update? |
In order to use, just build then pack the dependency: ``` npm run build npm pack packages/docsify-server-renderer/ ```
The same error found, even upgrade to the latest version of docsify |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still having this issue. Did anyone manage to find a fix? |
I looked around the code, and found the possible reason:
|
Same here with |
See this problem in issue: docsifyjs#704
See this problem in issue: docsifyjs#704
My code here:
Then:
There is shotcut of
docsify-server-renderer/build.js
I think maybe there is something wrong with my code or
build.js
after rollup-build, pls help me to check it.Best
The text was updated successfully, but these errors were encountered: