Skip to content

docsify-server-renderer error #704

Description

@ccforeverd

My code here:

// docs-renderer.jsconstfs=require('fs')constpath=require('path')constdocsifyRenderer=require('docsify-server-renderer')consttemplatePath=path.resolve(__dirname,'../../docs/index.template.html')constdocsifyConfig={basePath: '/src',// ...}constrenderer=newdocsifyRenderer({template: fs.readFileSync(templatePath,'utf-8'),config: docsifyConfig})asyncfunctiontest(){renderer.renderToString('docs/').then(console.log).catch(console.log)}test()module.exports=renderer

Then:

TypeError: Cannot read property 'indexOf' of undefined at AbstractHistory.parse (/Users/zhangshuyao/Sites/git/docs/node_modules/docsify-server-renderer/build.js:349:30) at Compiler.compile (/Users/zhangshuyao/Sites/git/docs/node_modules/docsify-server-renderer/build.js:553:37) at Renderer.<anonymous> (/Users/zhangshuyao/Sites/git/docs/node_modules/docsify-server-renderer/build.js:1126:28) at Generator.next (<anonymous>) at c (/Users/zhangshuyao/Sites/git/docs/node_modules/docsify-server-renderer/build.js:14:99) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:744:11) at startup (internal/bootstrap/node.js:285:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)

There is shotcut of docsify-server-renderer/build.js

// line 553varcurFileName=this$1.router.parse().file;// line 346-360AbstractHistory.prototype.parse=functionparse(path$$1){varquery='';varqueryIndex=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)}};

I think maybe there is something wrong with my code or build.js after rollup-build, pls help me to check it.

Best

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions