Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Export 'default' is not provided by 'mailgun.js' when importing in a Vite + React project #415

Open
Fedevs opened this issue Jul 10, 2024 · 7 comments

Comments

@Fedevs
Copy link

Fedevs commented Jul 10, 2024

Description

I'm encountering a SyntaxError when trying to import mailgun.js in a project created using Vite and React. The error message is as follows:

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/mailgun__js.js?v=68b1499c' does not provide an export named 'default'

This occurs when trying to import mailgun.js using the default import syntax:

Environment

Vite version: 5.2.0
React version: 18.2.0
Mailgun.js version: 10.2.1
Browser: Chrome 126.0.6478.127
Operating System: Windows 11

Expected Behavior

mailgun.js should be successfully imported without any syntax errors.

Actual Behavior

A SyntaxError is thrown indicating that the default export is not provided by mailgun.js.

import Mailgun from 'mailgun.js';
@MananSharma12
Copy link

MananSharma12 commented Jul 30, 2024

I'm getting the same issue in my SolidJS + Tauri project

Environment

Vite version: 5.0.0
SolidJS version: 1.7.8
Mailgun.js version: 10.2.3
Browser: Chrome 127.0.6533.73
Operating System: Windows 10

But using a dynamic import is a workaround for now:

let Mailgun: any;
import('mailgun.js').then(module => {
  Mailgun = module.default;
  initializeMailgun();
});

let mg: any;

function initializeMailgun() {
  const mailgun = new Mailgun(formData);
  mg = mailgun.client({
    username: "api",
    key: import.meta.env.VITE_MAILGUN_API_KEY,
  });
}

@JulianKingman
Copy link

Same issue using with typescript in a Turborepo package

@kii-dot
Copy link

kii-dot commented Aug 13, 2024

Having the same issue with remix and turborepo

@bramski
Copy link

bramski commented Aug 16, 2024

Same. Anybody gonna fix this at Mailgun? What a pain.

@bramski
Copy link

bramski commented Aug 16, 2024

Screenshot 2024-08-16 at 7 53 30 AM nah that's broken.

@sime-time
Copy link

Same issue with my QwikCity project

@joejordan
Copy link

I am having this same issue building a Bun project that uses mailgun.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants