Skip to content

Missing public folder but this is how you can create a public folder? #261

@officialdrafty

Description

@officialdrafty

In a React project, the public folder typically contains assets such as your favicon, manifest file, and other files that are served directly by the web server without being processed by the React app. If your project does not have a public folder, you can create one by following these steps:

  1. In your project root directory, create a new folder called public.
  2. Add any assets that you want to serve directly to the public folder.
  3. In your React app, you can reference these assets using the %PUBLIC_URL% placeholder. For example, if you have a file called favicon.ico in your public folder, you can reference it in your HTML file like this: .

If you are using create-react-app to set up your project, the public folder is already set up for you and you can add your assets to it directly. If you are not using create-react-app, you will need to configure your build process to copy the contents of the public folder to the build output directory. This can typically be done using a tool like cp or rsync. You can also use a build tool like Webpack to automate this process as part of your build pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions