JavaScript module doesn't work as expected for usage with Gatsby
See original GitHub issueWhen 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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Don’t know how to deal with it, for now removed “module” field from package.json.
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.