Describe the bug
yarn docz:dev on a fresh create-react-app fails with the error:
AssertionError [ERR_ASSERTION]: mount path must begin with "/"
To Reproduce
(Optional: 1. Generate a fresh create-react-app and install Docz as usual)
yarn docz:devcreate-react-app docz-bug
cd docz-bug
yarn add docz --dev
# add scripts to package.json
yarn docz:dev
AssertionError [ERR_ASSERTION]: mount path must begin with "/"
at mount (C:\Users\Kalyn Robinson\Documents\Development\aap\spill\node_modules\koa-mount\index.js:33:10)
at Object.add (C:\Users\Kalyn Robinson\Documents\Development\aap\spill\node_modules\docz-core\dist\index.js:1:104906)
at promise.then (C:\Users\Kalyn Robinson\Documents\Development\aap\spill\node_modules\docz-core\node_modules\webpack-serve\lib\app.js:45:17)
at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 1.
Expected behavior
Docz should successfully compile.
Environment
Additional context/Screenshots
Docz provides koa-mount with the path \public; koa-mount only accepts paths that begin with /. Hardcoding the path as /public in koa-mount/index.js circumvents this issue (please forgive me for this sin).
I tried this fresh setup using create-react-app and docz and everything worked fine, I think that this can be a windows problem 😕
Thanks, I suspected as much! I'll have to take a crack at it this weekend. 😄
Hi, I've run into this issue as well.
I've narrowed it down to https://github.com/pedronauck/docz/blob/master/packages/docz-core/src/webpack/devserver.ts#L46 . The fix is simple: just use path.posix.join to force a forward slash for the route as path.join will result in a backslash seperator on windows.
I can submit a PR if you'd like?
When the next release comes out, I'm in great need of this correction?
Landed on 0.12.16 ✅
Most helpful comment
When the next release comes out, I'm in great need of this correction?