question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Public folder broken in devserver

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
patricksevatcommented, Jan 31, 2019
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

3reactions
DennisJamincommented, Feb 1, 2019

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Public folder broken in devserver · Issue #528 · doczjs/docz
I think 4157e05 broke public assets folder in dev-mode. Previously the public folder was hosted at /public , now it is used publicDir...
Read more >
Having troubles with Webpack Dev Server settings
What I would like to do is to make Webpack Dev Server serve index.html from the src folder, but to request static assets...
Read more >
DevServer - webpack
devServer : { static: { directory: path.join(__dirname, 'public'), } ... This option is ignored for Node 15.0.0 and above, as spdy is broken...
Read more >
Webpack — Understanding the 'publicPath' mystery - Medium
We have the following folder structure in place. ... Basically whenever the path config is missing, webpack-dev-server considers it's values ...
Read more >
HTML and Static Assets - Vue CLI
The file public/index.html is a template that will be processed with ... Any static assets placed in the public folder will simply be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found