danestves / strapi-plugin-preview-content

A plugin for Strapi Headless CMS that provides content preview to integrate with any frontend
MIT License
64 stars 27 forks source link

Broken on 3.6.x #13

Closed pr0gr8mm3r closed 3 years ago

pr0gr8mm3r commented 3 years ago

This plugin causes errors when building the admin ui of strapi v.3.6.0. Some hooks used by the overwritten files have changed or have been removed, more specifically those used in content-manager/admin/src/containers/EditView/Header/utils/connect.js and content-manager/admin/src/containers/ListView/index.js

This relative module was not found:

* ../../../../hooks/useDataManager in ./.cache/plugins/strapi-plugin-content-manager/admin/src/containers/EditView/Header/utils/connect.js

and

_hooks.useQueryParams is not a function
danestves commented 3 years ago

Hi! The plugin is not tested for 3.6 yet, i'm going to update the README.md with that, soon will be a next release with this, thanks for the issue

SalahAdDin commented 3 years ago

Yeah, i found the same problem with 3.6.0:

remote: Error: Module not found: Error: Can't resolve '../../../../hooks/useDataManager' in '/tmp/build_2c709eba/.cache/plugins/strapi-plugin-content-manager/admin/src/containers/EditView/Header/utils'
remote:     at /tmp/build_2c709eba/node_modules/strapi-admin/index.js:71:23
remote:     at finalCallback (/tmp/build_2c709eba/node_modules/webpack/lib/Compiler.js:257:39)
remote:     at onCompiled (/tmp/build_2c709eba/node_modules/webpack/lib/Compiler.js:265:20)
remote:     at /tmp/build_2c709eba/node_modules/webpack/lib/Compiler.js:670:21
remote:     at eval (eval at create (/tmp/build_2c709eba/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1)
remote:     at /tmp/build_2c709eba/node_modules/webpack/lib/Compilation.js:1173:13
remote:     at /tmp/build_2c709eba/node_modules/webpack/lib/Compilation.js:1096:25
remote:     at /tmp/build_2c709eba/node_modules/webpack/lib/Compilation.js:1017:13
remote:     at /tmp/build_2c709eba/node_modules/neo-async/async.js:2830:7
remote:     at /tmp/build_2c709eba/node_modules/neo-async/async.js:2830:7
remote:     at done (/tmp/build_2c709eba/node_modules/neo-async/async.js:2863:11)
remote:     at /tmp/build_2c709eba/node_modules/neo-async/async.js:2818:7
remote:     at /tmp/build_2c709eba/node_modules/webpack/lib/Compilation.js:1017:13
remote:     at /tmp/build_2c709eba/node_modules/neo-async/async.js:2830:7
remote:     at /tmp/build_2c709eba/node_modules/neo-async/async.js:2830:7
remote:     at done (/tmp/build_2c709eba/node_modules/neo-async/async.js:2863:11)
remote: error Command failed with exit code 1.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to uzmani-tech-back-end.
remote:
danestves commented 3 years ago

Yeah, this days i'm going to work on give support for Strapi 3.6

pr0gr8mm3r commented 3 years ago

There seems to be some sort of new feature for plugins called injection zones. They are not documented yet, because I believe they will be fully introduced in v4, and there are none where this plugin needs (in the list view icon buttons and the edit view header actions), but they will eventually remove the need for overriding these files. Just something to keep in mind for the future.

Some examples:

gitfer commented 3 years ago

Same problem here, managed to start 'npm run develop' editing https://github.com/danestves/strapi-plugin-preview-content/blob/4d63f6cff197edd69a7864869db97bf5db595786/src/config/functions/bootstrap.js replacing register with registerMany but 'npm run build' still crashes with this issue's output.

polcode-dzielonka commented 3 years ago

I have done some changes to the code, to allow build and start on 3.6. Maybe you could make some use of it. I have tested and it worked locally :) @danestves #15 #14

SalahAdDin commented 3 years ago

@polcode-dzielonka does your pull request supersede the another pull request?

polcode-dzielonka commented 3 years ago

Yes @SalahAdDin

danestves commented 3 years ago

Awesome! Testing and doing merge! Thank you @polcode-dzielonka

danestves commented 3 years ago

@all-contributors please add @polcode-dzielonka for code

allcontributors[bot] commented 3 years ago

@danestves

I've put up a pull request to add @polcode-dzielonka! :tada:

danestves commented 3 years ago

@all-contributors please add @pr0gr8mm3r for code

allcontributors[bot] commented 3 years ago

@danestves

I've put up a pull request to add @pr0gr8mm3r! :tada:

danestves commented 3 years ago

Closing this issue since https://github.com/danestves/strapi-plugin-preview-content/pull/15 was merged and @pr0gr8mm3r and @polcode-dzielonka was added as contributors for the repo, thank you!

polcode-dzielonka commented 3 years ago

Thanks guys :)

blb78 commented 3 years ago

Hi,

sorry but still doesn't work on a new project

platform : win10 node version : v12.22.1 package.json

{
  "name": "test-preview",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {},
  "dependencies": {
    "strapi": "3.6.1",
    "strapi-admin": "3.6.1",
    "strapi-utils": "3.6.1",
    "strapi-plugin-content-type-builder": "3.6.1",
    "strapi-plugin-content-manager": "3.6.1",
    "strapi-plugin-users-permissions": "3.6.1",
    "strapi-plugin-email": "3.6.1",
    "strapi-plugin-upload": "3.6.1",
    "strapi-plugin-i18n": "3.6.1",
    "strapi-plugin-preview-content": "1.0.2",
    "strapi-connector-bookshelf": "3.6.1",
    "knex": "0.21.18",
    "sqlite3": "5.0.0"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "9c0e9089-a6f3-4f51-a33c-32f00d16971e"
  },
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": "^6.0.0"
  },
  "license": "MIT"
}

Module not found: Error: Can't resolve '../../../../hooks/useDataManager' in 'C:\Users\jdoe\Documents\dev\test-preview\.cache\plugins\strapi-plugin-content-manager\admin\src\containers\EditView\Header\utils'

What I am missing ?

I will try on linux.

danestves commented 3 years ago

Hi, you put the strapi-files required in your project? And later rebuild the project?

cedrtang commented 3 years ago

@blb78 I think your problem is either:

Also, you'll need this dependency: "strapi-helper-plugin": "3.6.1"

blb78 commented 3 years ago

yeah, I have copied the wrong version of the strapi-files folder My bad, it works now. Thx for your help

danestves commented 3 years ago

Thank you for the help guys!