| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Seems like the red build has the same cause as the red builds on master: [05:49:20] Failed to load external module @babel/register
[05:49:20] Requiring external module babel-register
fs.js:25
'use strict';
^
ReferenceError: internalBinding is not defined
at fs.js:25:1
at req_ (/Users/travis/build/docsifyjs/docsify-cli/node_modules/natives/index.js:137:5)
at Object.req [as require] (/Users/travis/build/docsifyjs/docsify-cli/node_modules/natives/index.js:54:10)
at Object.<anonymous> (/Users/travis/build/docsifyjs/docsify-cli/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/travis/build/docsifyjs/docsify-cli/node_modules/babel-register/lib/node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
|
Sorry, something went wrong.
|
Great PR.. Is there another way around this for local development? EDIT: For anyone else reading, my workaround was to dynamically set base path depending on window.location. It's hacky but it works: function basePath() {
var origin = window.location.origin;
var path = window.location.pathname;
return origin + path.replace(/index.html/gi, '');
}
|
Sorry, something went wrong.
There was a problem hiding this comment.
Good idea, just needs conflicts resolved.
Sorry, something went wrong.
|
A workaround is to use another static serve like apache or nginx, and configure the root path in one of those. |
Sorry, something went wrong.
|
Unfortunately, it seems like the popular NPM packages for static serving don't support this feature. Unless I overlooked it, serve, http-server, and live-server don't have any options for this. Seems like such a standard necessary feature for a static server. |
Sorry, something went wrong.
|
@trusktr It's supported via middleware. It should be possible to rewrite all requests matching the configured path. e.g. local-web-server - https://github.com/lwsjs/rewrite And so on. |
Sorry, something went wrong.
|
Seems like what we should do is instead of building our own static server CLI with defaults, allow any options to be passed to the underlying tool, support passing in middleware, and maybe have our own default set of middleware if we need. Thoughts? EDIT: even if we were to do this later, I'm still in favor of merging this PR. |
Sorry, something went wrong.
|
I fixed that for the moment using local-web-server - https://github.com/lwsjs/rewrite Running command: ws -p 3000 -r '/base-path/(.*) -> http://localhost:3000/$1'. It seems to work on / and on /base-path/ Maybe when I'll get some time will fix the CI and complete the PR |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Before this PR
Using a base-path in $docsify config makes doscify serve . unusable for local development - all requests just return 404.
After this PR
I'll be able to run docsify serve . --base-path 'my-project' to replicate the behaviour of GitHub pages (which always uses a sub path, e.g. https://iamdanfox.github.io/my-project).
fixes #32 cc @davestewart who originally filed the issue