Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
import MailchimpSubscribe from 'react-mailchimp-subscribe';
Solved! Go to the solution
This is an accepted solution.
Hello @pbal, the reason is that you're using a "CJS" only module in a Hydrogen Vite project which now uses "ESM" by default, to fix that, you can refer to this video: https://www.youtube.com/watch?v=jmNuEEtwkD4
My personal solution for that is using dynamic import the Mailchimp library like this:
const MailchimpModule = await import('react-mailchimp-subscribe');
Learn more about dynamic import here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#import_a_module_f...
This is an accepted solution.
Hello @pbal, the reason is that you're using a "CJS" only module in a Hydrogen Vite project which now uses "ESM" by default, to fix that, you can refer to this video: https://www.youtube.com/watch?v=jmNuEEtwkD4
My personal solution for that is using dynamic import the Mailchimp library like this:
const MailchimpModule = await import('react-mailchimp-subscribe');
Learn more about dynamic import here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#import_a_module_f...
Awesome. This is very helpful. Thank you!