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

fix: support cjs modules when loading typography config #10610

Merged
merged 1 commit into from
Dec 21, 2018

Conversation

Sekhmet
Copy link
Contributor

@Sekhmet Sekhmet commented Dec 21, 2018

Description

After PR #10545 typography is loaded using require(...).default:

// typography links to the file set in "pathToConfigModule"
typography = require(`./.cache/typography.js`).default

It works with custom configs (which are ES6 modules), but it doesn't work with CommonJS modules.
Default config uses CommonJS export:
} else {
module = `const Typography = require("typography")
const typography = new Typography()
module.exports = typography`
}

This is why typography is not properly loaded and page crashes on load when using default config.

Related Issues

Fixes #10609

Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good catch. I didn't think of testing that as it never occurred to me that someone tells you to use it without a config. The package README itself doesn't mention that 😆

Thanks for the fix 👍

@DSchau DSchau merged commit 2f7303d into gatsbyjs:master Dec 21, 2018
@Sekhmet Sekhmet deleted the s-typography branch December 21, 2018 16:16
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this pull request Jan 22, 2019
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

Successfully merging this pull request may close these issues.

3 participants