My project contains one separate folder for favicon icons in “./src/assets/favicon”.
During the building process in my local environment using “npm run build” script, it creates the “public” as intended, containing everything I need, including the “favicon” folder on path “./public/assets/favicon”.
But, if I try to build and deploy the project using Netlify, it just simply ignores “favicon” folder, whereas every other folder/file is in place.
Deployed Website: https://fm-contact-form-danil-dikhtyar.netlify.app/
GitHub Repo: GitHub - Rock-n-Roll-CRC/FM-Contact-Form: Form with several input types and validation.
Logs: Netlify
This is a duplicate of this other thread posted just prior:
Please try not to create multiple threads for the same issue.
You mention that you have src/assets/favicon
and that your build creates public/assets/favicon
.
But both of those paths seem incorrect.
Your repository contains src/assets/icons/favicon/
.
When I run your build, the resulting public
folder is exactly the same as on Netlify.
So the issue isn’t Netlify, it’s related to your own project.
You are copying files with this line:
{
"name": "fm-contact-form",
"version": "1.0.0",
"description": "Form with several input types and validation.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "husky",
"copy:assets": "copyfiles -u 1 ./src/assets/**/* public",
"copy:html": "copyfiles -u 1 ./src/*.html public",
"watch:assets": "onchange \"src/assets/**/*\" -- npm run copy:assets",
"watch:html": "onchange \"src/*.html\" -- npm run copy:html",
"watch:sass": "sass --watch src/styles:public",
"watch:ts": "tsc --watch",
"build:sass": "sass src/styles:public",
"build:ts": "tsc",
"serve": "browser-sync start --server public --files public",
"copy": "npm-run-all --parallel copy:*",
"watch": "npm-run-all --parallel watch:*",
Which is using this dependency:
"stylelint-rem-over-px": "^1.0.1",
"typescript": "^5.5.4",
"typescript-eslint": "^8.0.0"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
},
"dependencies": {
"autoprefixer": "^10.4.20",
"browser-sync": "^3.0.2",
"copyfiles": "^2.4.1",
"cssnano": "^7.0.4",
"npm-run-all": "^4.1.5",
"onchange": "^7.1.0",
"postcss-cli": "^11.0.0",
"sass": "^1.77.8",
"stylelint-declaration-strict-value": "^1.10.6",
"stylelint-no-unsupported-browser-features": "^8.0.1"
},
"type": "module"
}
Even running copy:assets
alone shows the favicon
folder is not copied.
My guess is that you missed this part of the copyfiles
documentation:
If you change the copy:assets
script in your package.json
to:
"copy:assets": "copyfiles -u 1 './src/assets/**/*' public",
Then you will find that it works.
1 Like