I’m working on a strapi.io plugin (typescript) and I would like to use the node package file-type.
import {fileTypeFromBuffer} from “file-type”;
My plugin compiles just fine. But strapi does not start.
I get:
…/strapi-server.js: require() of ES Module …/node_modules/file-type/index.js from …myjsfile.js not supported.
Instead change the require of index.js in …myjsfile.js to a dynamic import() which is available in all CommonJS modules.
I’m not sure if I can change anything since my code runs as a plugin in strapi. And I have no desire to change the strapi code.
Has anyone solved the module loading problem ?
Regards
System Information
- Strapi Version: 4.6.2
- Operating System: Mac
- Database: psql
- Node Version: 18
- NPM Version:
- Yarn Version: 1.2