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 electron require #302

Merged
merged 1 commit into from
Sep 2, 2020
Merged

Fix electron require #302

merged 1 commit into from
Sep 2, 2020

Conversation

Rigellute
Copy link
Collaborator

Turns out that using import from electron causes the error

fs.existsSync is not a function

when running yarn cosmos.

Fix is to use require instead of import.

Turns out that using `import` from electron causes the error

> fs.existsSync is not a function

when running `yarn cosmos`.

Fix is to use `require` instead of `import`.
@Rigellute Rigellute merged commit 2b115e2 into master Sep 2, 2020
@Rigellute Rigellute deleted the fix-electron-require branch September 2, 2020 12:33
@andyrichardson
Copy link
Collaborator

@Rigellute what was the issue you were seeing before?

Electron imports are ignored when building cosmos. Maybe you had the BUILD_ENV environment variable set to electron?

@wgolledge
Copy link
Contributor

It was TypeError: fs.existsSync is not a function happening on all cosmos instances (Netlify deploy etc). I'm guessing the ignore might still do the import but then doesn't include it?

@andyrichardson
Copy link
Collaborator

@wgolledge thanks for clearing that up! I thought it might have been a local reproduction issue.

Do we know when it was first introduced? I assume it was after a dependency update but can't source the first occurrence.

@wgolledge
Copy link
Contributor

I do indeed! Basically just when the inline require was flipped to import #296

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