How can add all files in public directory to the build directory with parcel-bundler

I use parcel-bundler on a react app. But I realized I need to redirect all files index.html using HTTP files but when I add a .htaccess file to my public directory. It's not added to the dist folder after building the project.

How can I achieve this without adding files manually after building?


  • You can set up a custom copy script in your package.json that you can use in your build script or wherever you need :)

      "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build && npm run copy",
        "test": "react-scripts test",
        "eject": "react-scripts eject",
        "copy": "cp public/.htaccess dist"

    Note: Windows users will need to use the copy command rather than cp