我尝试在我的 vite React 项目中实现 MailerSend 包,但在生产时出现错误
vite.config.js
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return defineConfig({
plugins: [react()],
define: {
"process.env": env,
},
server: {
host: "localhost",
hmr: {
clientPort: 5173
},
},
});
};
在 app.js 中,当我导入它时,它会崩溃
import { EmailParams, MailerSend } from "mailersend";
错误
Uncaught ReferenceError: process is not defined
at V0 (index-8e47e207.js:134:1613)
at index-8e47e207.js:134:16404
我也遇到同样的问题,请问你解决了吗?
谢谢