Closed dzakki closed 4 weeks ago
@dzakki why is this closed? it's still an issue with 5.3.0
Hi @michalkos , are you using the useContentManagerContext
on your custom field?
Hi @michalkos , are you using the
useContentManagerContext
on your custom field?
yes
Hi @michalkos , are you using the
useContentManagerContext
on your custom field?yes
here are my solutions to solve that issue when build to production.
strapi-admin
on the plugin
// remove this
"./strapi-admin": {
"source": "./admin/src/index.js",
"import": "./dist/admin/index.mjs",
"require": "./dist/admin/index.js",
"default": "./dist/admin/index.js"
},
strapi-admin.js
on the plugin
'use strict';
import admin from './admin/src/index';
export default admin;
5. add file strapi-server.js on the plugin
'use strict';
module.exports = require('./dist/server');
6. cd src/plugins/my-plugin
7. npm install
8. npm run build
9. back to root dir cd ../../../
10. npx strapi ts:generate-types
11. add the plugin to workspaces root package.json, e.g `"workspaces": ["./src/plugins/my-plugin"]`
12. npm install in root directory
13. npm run build
14. npm run start
Interesting. I tried to just add workspace and keep everything else as it was before it worked as well. Thanks!
Interesting. I tried to just add workspace and keep everything else as it was before it worked as well. Thanks!
Great! Just fyi, if you do rebuild again and got error, perhaps you need to repeat the solutions. Mostly what I did is not commit the workspaces after build.
Bug report
Required System information
Describe the bug
i was using useContentManagerContext from
helper-plugin
on Strapi 4 before, and it's working well. but after migrating to v5 from'@strapi/strapi/admin'
it doesn't work well. it returned an error:useDocumentLayout
must be used within StrapiApp``.this error only appear when running in the prod mode (npm run build & npm run start)
Steps to reproduce the behavior
npm run build
npm run start
Expected behavior
it's should be working well without error
Screenshots
Code snippets
Additional context
Add any other context about the problem here.