VirtusLab-Open-Source / strapi-plugin-comments

A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.
MIT License
405 stars 63 forks source link

Undeclared dependency when building with Strapi v4.8.1 #199

Closed hypnotoad08 closed 1 year ago

hypnotoad08 commented 1 year ago

When running npm run build with Strapi V4.8.1 and strapi-plugin-comments 2.2.8 getting an error during webpack.

Webpack █████████████████████████ building (63%) 1/1 entries 9399/9667 dep
endencies 2243/2723 modules 275 active ...ules\@strapi\plugin-users-permissions\admin\src\hooks\useRolesList\reduc
er.js

ModuleNotFoundError: Module not found: Error: Package path ./addon/display/placeholder is not exported from package D:\GitHub\Strapi-test\node_modules\codemirror (see exports field in D:\GitHub\Strapi-test\node_modules\codemirror\package.json)

Opened an issue with Strapi and it was determined the issue is actually with strapi-pluglin-comments - "the issue is with the plugin strapi-plugin-comments, they've used dependencies in their plugin in this case codemirror but they've not declared it in their package.json so the plugin is using our version which is v6 which has breaking changes. So realistically, the plugin author needs to double check all deps they've used are declared in their package.json to avoid this happening in the future." - https://github.com/strapi/strapi/issues/16100

cyp3rius commented 1 year ago

Checking which dependency cause the issue.

hypnotoad08 commented 1 year ago

Checking which dependency cause the issue.

It's codemirror, if I'm not mistaken.

cyp3rius commented 1 year ago

Right it's directly used in the WYSIWYG Editor from Strapi. Fix should be in 1-2 hours.

cyp3rius commented 1 year ago

@hypnotoad08 fix releases as part of v2.2.9 with all dependencies declared and upgraded (as well Strapi to 2.2.8)

Issue was caused by the Editor.ts file and dependency in there. We simply copied WYSIWYG from Strapi package without providing declared package (mistake, indeed). All was working till change of codemirror in code as we've been consuming this. Now our plugin is aligned with the Content Manager plugin file and this shouldn't happen.

BTW. Would be nice for Strapi to expose their WYSIWYG as a component to Design System :)

cyp3rius commented 1 year ago

Please check and we'll close the issue.

hypnotoad08 commented 1 year ago

Please check and we'll close the issue.

Can confirm 2.29 resolves the issue, thank you for the prompt fix!