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: Dispatch correctly for bundlers like webpack #84

Merged
merged 11 commits into from May 24, 2018
Merged

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented May 14, 2018

Frontend bundlers like webpack and rollup will statically resolve all requires, which might break the build or switch to the main process implementation in renderers. This PR should fix this by using module.require for importing the main implementation, which bypasses static bundlers entirely.

The updated example also verifies that sandbox mode works. Next step would be to update tests to use sandbox: true and then remove the disclaimer from docs and add a guide on how to use the SDK in sandbox mode properly, instead.

This diff is rather large, see the comment below for the relevant section. There should be sufficient code documentation above that statement explaining the reasoning behind this approach.

See #81 for more information.

@jan-auer jan-auer requested a review from timfish May 14, 2018 15:04
@jan-auer jan-auer self-assigned this May 14, 2018
process.type === 'browser'
? require('./main').MainFrontend
? module.require('./main').MainFrontend
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the actual fix, the rest is just an updated example.

@jan-auer jan-auer requested a review from HazAT May 23, 2018 14:13
@jan-auer
Copy link
Member Author

This is ready now.

Copy link
Member

@HazAT HazAT left a comment

Choose a reason for hiding this comment

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

Like the IPC_PING 🏅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants