Strapi Version: 3.3.4
Operating System: macOS 11.1
Database: postgres 13.1
Node Version: 14.8.0
NPM Version: 6.14.10
Yarn Version: 1.22.10
On the customization documentation page , instructions are provided for how to modify the admin panel, namely by create a
./admin folder in your project and adding/replacing files to/from the admin folder of the
How would I go about modifying files from other directories in the
strapi-admin module, for example
In other words, adding files to
./admin in my project replaces or extends the files in the admin folder of the
strapi-admin module. How would I replace or add to files in
/services, or module root level files like
index.js? It is possible with the way extending plugins works, so I feel like it should be possible here as well.
Hello, unfortunately you can only extend the admin folder from strapi-admin. Core files can’t be extented.
I’ll add a feature request on github for the team to consider. I think there are situations where it could be pretty helpful.
I noted that with extensions this should be possible, as
./extensions/a-plugin/ = ./node_modules/strapi-plugin-a-plugin, so from within
./extensions/a-plugin I can add an
admin folder, or a
config folder, etc. It looks like in strapi core (
load-extensions.js, line 39), that all files in that directory are loaded as overwrites. However, it seems like they are not perfectly just dropped in as replacements, by the following test case:
./extensions/content-manager/config/routes.json without any changes, and when I run
npm run develop I get
> firstname.lastname@example.org develop /Users/acalvino4/Code/gem/sb/sb-admin
> strapi develop
[2021-01-11T14:11:53.970Z] debug ⛔️ Server wasn't able to start properly.
[2021-01-11T14:11:53.972Z] error TypeError: Cannot read property 'findContentTypes' of undefined
at routerChecker (/Users/acalvino4/Code/gem/sb/sb-admin/node_modules/strapi/lib/middlewares/router/utils/routerChecker.js:36:33)
What else is happening besides the files in
./extensions being used as drop-in replacements for those in
./node_modules? Is this a bug I should file?
I make my own solution for this issue.
1.- modify your package.json, with the next: “strapi-admin”: “file:./package/strapi-admin”, with this configuration, you need to take all the strapi-admin folder from node_modules, and put it on another directory, like ./package/… for example.
2.- This will copy your strapi-admin folder (with all your modifications) to node_modules.
And that’s all, all the things you modify in strapi admin, will be reflected like it was by default. I hope this works for you. Greetings.
P.S: If you upgrade your strapi version, you need to remake all in the new strapi-admin version.