Docz: Public folder broken in devserver

Created on 19 Dec 2018  ·  12Comments  ·  Source: doczjs/docz

Bug Report

Describe the bug

I think https://github.com/pedronauck/docz/commit/4157e054393c532e0e51605ad2186ac5dce1e19d broke public assets folder in dev-mode. Previously the public folder was hosted at /public, now it is used publicDir (so it is hosted at /).

See the difference between:
https://github.com/pedronauck/docz/commit/4157e054393c532e0e51605ad2186ac5dce1e19d#diff-0a3cd3c257db10b0bb4b70618def4ef6R18
https://github.com/pedronauck/docz/commit/4157e054393c532e0e51605ad2186ac5dce1e19d#diff-0a3cd3c257db10b0bb4b70618def4ef6L47

To Reproduce

  1. In doczrc.js, set public: '/public'.
  2. Add an image: ![](/public/test.png)
  3. Build with docz build (everything works as expected)
  4. Build with docz dev

The image won't work, since it's not found at /public/test.png. It is instead hosted at /test.png.

Expected behavior

The public folder should be hosted the same way in both docz dev and docz build.

Most helpful comment

export default {
  base: "/specifications/",
}

const publicDirPath = path.resolve(paths.root, args.public) // ^ C:\Users\USER\WebstormProjects\specifications\public const publicDir = path.join(paths.root, publicDirPath) // ^ C:\Users\USER\WebstormProjects\specifications\C:\Users\olfedias\WebstormProjects\specifications\public
public is completely broken on Windows :(

I ran into the same issue, so made a PR: https://github.com/pedronauck/docz/pull/614/commits

All 12 comments

Oh for sure, sorry, my bad on that 🙏 I'm launching some patch RIGHT NOW 🏃

Fixed on v0.13.5

@pedronauck i'm testing and still have no access to /public. I'm getting Page Not Found in dev (no console error though 🤔) and it works in prod.

export default {
  public: "./public",
  themeConfig: {
    mode: "dark",
    logo: {
      src: "/public/logo.png",
      width: 150
    }
  }
};

Tested this on v0.13.5 and v0.13.7.

Any idea?

export default {
  base: "/specifications/",
}
  const publicDirPath = path.resolve(paths.root, args.public)
  // ^ C:\Users\USER\WebstormProjects\specifications\public
  const publicDir = path.join(paths.root, publicDirPath)
  // ^ C:\Users\USER\WebstormProjects\specifications\C:\Users\olfedias\WebstormProjects\specifications\public

public is completely broken on Windows :(

@pedronauck i'm testing and still have no access to /public. I'm getting Page Not Found in dev (no console error though ) and it works in prod.

export default {
  public: "./public",
  themeConfig: {
    mode: "dark",
    logo: {
      src: "/public/logo.png",
      width: 150
    }
  }
};

Tested this on v0.13.5 and v0.13.7.

Any idea?

Same here, I just tested it on v0.13.7.

Edit (06/01/2019):
@DennisJamin You're right, i'm using Linux Mint

Also an issue for me on v0.13.5 and v0.13.7 @pedronauck

Specifically: instead of getting an image at /public/img/loading.gif, looks like express does a rewrite and I get:

http://localhost:3000/public/img/loading.gif#/ in the url bar

Any solution?

export default {
  base: "/specifications/",
}

const publicDirPath = path.resolve(paths.root, args.public) // ^ C:\Users\USER\WebstormProjects\specifications\public const publicDir = path.join(paths.root, publicDirPath) // ^ C:\Users\USER\WebstormProjects\specifications\C:\Users\olfedias\WebstormProjects\specifications\public
public is completely broken on Windows :(

I ran into the same issue, so made a PR: https://github.com/pedronauck/docz/pull/614/commits

This does not only seem to be a Windows issue, I'm facing the exact same on OSX (and have it fixed once I apply the appropriate fix).

This is still an issue for me.

This also seems broken to me too...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

merelinguist picture merelinguist  ·  3Comments

mquandalle picture mquandalle  ·  3Comments

ilyanoskov picture ilyanoskov  ·  3Comments

regrettably picture regrettably  ·  3Comments

danburzo picture danburzo  ·  3Comments