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

exports is not defined error in client side bundle #284

Open
svu-aau opened this issue Apr 7, 2024 · 0 comments
Open

exports is not defined error in client side bundle #284

svu-aau opened this issue Apr 7, 2024 · 0 comments

Comments

@svu-aau
Copy link

svu-aau commented Apr 7, 2024

Hi,

Has anyone ever seen the exports is not defined error in the browser from gatsby-source-sanity when loading a site in dev mode? The exact same site in production does not display the error. I am using the latest version of this package (v7.6.3)
To be more specific, the error’s source is from ./node_modules/gatsby-source-sanity/lib-es5/debug.js, which is only a few lines:

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
  return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var debug_1 = __importDefault(require("debug"));
exports.default = (0, debug_1.default)('sanity');
//# sourceMappingURL=debug.js.map

Here is the dev site running on Digital Ocean with the error (I am using Digital Ocean so I can run the site in dev mode in order to use it as the CMS Preview site, ie, hot reload). Same on my local server:
https://springshow-2024-cms-preview-site-9rydb.ondigitalocean.app/

And here is the production site without the error:
https://2024springshow.academyart.edu/

Both the dev and production sites were built using the same git commit.

For context, I recently replaced the gatsby-plugin-image with the gatsby-plugin-sanity-image package in order to use Sanity’s image hotspot / cropping feature; the package works great! Unfortunately, this odd error with gatsby-source-sanity in dev mode. Prior to installing the package the dev site loaded fine at Digital Ocean. It’s odd that error is not from this package but from gatsby-source-sanity and it’s about module exports.

The exports object shouldn't be in the client bundle, correct? From what I understand, when creating the development bundle, Gatsby uses a lightweight version the transpiler and bundler (compared to when creating the production bundle) that might not have thoroughly updated the use of the exports object in the browser????

Thanks in advance for any suggestions!

Screenshot 2024-04-04 at 4 16 57 PM

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

1 participant