Skip to content

Storybook does not serve files from CRA public folder #1537

@gihrig

Description

@gihrig

I attempted to follow "The guidelines for contributing" "Reproductions" script, but I couldn't get that to work, see #1536.

Here's an abbreviated version that describes the problem:

create-react-app tester
cd tester
echo "foobar" > public/file
yarn start
# in another terminal
curl localhost:3000/file # outputs "foobar" <--- Works as expected
# in first terminal
getstorybook
yarn storybook
# in another terminal
curl localhost:6006/file # outputs "foobar" <--- "Cannot GET /file"

Specifically the error is wrapped in an html file:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /file</pre>
</body>
</html>

I have tried with files of various extensions (.html, .json, .ico, .ttf, .woff, etc.), none are served.

Any ideas on what needs to be done to get Storybook to serve files from a CRA app's public folder and subdirectories?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions