Howdy everybody.
I’ve been making an attempt to analysis and remedy this myself for fairly a while, however I can’t appear to discover a answer for importing and utilizing nodemailer in my app. (Sorry if the next data appears scattered or jumps round – I’ve simply been making an attempt so many alternative issues and I’m at a whole loss.)
I’m utilizing Cocos Creator 3.8.1 and have already adopted the next steps:
My script already consists of:
import nodemailer from 'nodemailer';
Each time I attempt to use the imported module the editor throws a lacking class error and my script disappears due to a “compile error”. For example, I’ll simply use the code above after which, within the begin part, add:
console.log(nodemailer);
This leads to the lacking script error within the editor. (if I remark out the code, the script is restored)
I additionally adopted the instance within the docs (Cocos Creator 3.8 Guide – Exterior Module Utilization Case) and put in protobufjs with no points, I simply cant appear to get nodemailer to work.
Additionally, after I hover over ‘nodemailer’ on the finish of the import, Visible Studio signifies that it’s a module and factors to the file “index.d.ts”.
However for some purpose, after I strive one thing so simple as this:
const nodemailer = require('nodemailer');
console.log(nodemailer);
I obtain a message from the console that the nodemailer module was not discovered.
My package deal.json within the root challenge folder has these dependencies listed:
"dependencies": {
"@sorts/nodemailer": "^6.4.13",
"nodemailer": "^6.9.7",
"protobufjs": "^7.2.5"
}
My tsconfig.json within the root challenge folder has these compiler choices:
"compilerOptions": {
"strict": false,
"allowSyntheticDefaultImports": true
}
I may very simply be overlooking one thing easy, so I’d be completely happy to reply any questions or give extra data!


