question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript module doesn't work as expected for usage with Gatsby

See original GitHub issue

When using the library with Gatsby, the production build doesn’t work when the it uses the .mjs file. Reverting back to the JS file fixes the issue.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asmyshlyaev177commented, Feb 6, 2019

Don’t know how to deal with it, for now removed “module” field from package.json.

0reactions
ajaynscommented, Feb 6, 2019

I don’t think it’s a filename issue, but rather an issue cause of the different way a JS module is exported in comparison to a normal ES export. I will look into what could possibly be causing the issue when I get the time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gatsby-node.js doesn't allow ES6 import · Issue #7810 - GitHub
Description gatsby-node.js doesn't allow ES6 javascript. Steps to reproduce gatsby-node.js: import myOnCreatePage from '.
Read more >
Troubleshooting Common Errors - Gatsby
As you encounter errors while developing with Gatsby, it is likely you'll run into something that other users have already stumbled upon.
Read more >
Gatsby 3rd party scripts not working as intended
Instead of including your script into html, better require() / import it from your top-level javascript module, something like src/pages/index.
Read more >
Reduce JavaScript payloads with tree shaking - web.dev
In dev builds, this doesn't change anything, as the entire module gets imported regardless. In production builds, webpack can be configured to "shake"...
Read more >
Import JavaScript as a string with WebPack v5 (and Gatsby)
Gatsby uses react-refresh , and apparently it works by splicing a bunch of code into every module. This is all good, I don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found