What was reported:
Issue mailgun/mailgun-js#415 (closed, 13 comments): In a Vite + React project, `import Mailgun from 'mailgun.js'` fails with `SyntaxError: The requested module ... does not provide an export named 'default'`. The web build of mailgun.js ships only in AMD format, which Vite cannot consume directly.
What works:
In a Vite project, import Mailgun from 'mailgun.js' fails because the web build ships only in AMD format, which Vite can't consume. Workaround: convert the AMD build to CommonJS with the Babel plugin. Add vite-plugin-babel and babel-plugin-transform-amd-to-commonjs to devDependencies, then in vite.config.ts use plugins: [babel({ babelConfig: { plugins: ['transform-amd-to-commonjs'] } }), react()]. The commenter verified this works.