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(bundle): fix mixed exports issue #224

Merged
merged 3 commits into from
Aug 31, 2020
Merged

fix(bundle): fix mixed exports issue #224

merged 3 commits into from
Aug 31, 2020

Conversation

eunjae-lee
Copy link
Contributor

@eunjae-lee eunjae-lee commented Aug 28, 2020

Summary

fixes #222

This PR fixes the mixed exports issue.
Since 7880205, search-insights started to have both default export and named exports.
There is an issue related to this in rollup.

I ended up modifying the bundle output.

from

exports.createInsightsClient=createInsightsClient;
exports.default=node

to

module.exports=node;
module.exports.createInsightsClient=createInsightsClient;

I couldn't find any elegant way to fix this other than this.

Result

All of the following works fine.

const aa = require("search-insights");

const { createInsightsClient } = require("search-insights");

import aa, { createInsightsClient } from "search-insights";

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 28, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 304e924:

Sandbox Source
Vanilla Configuration

@eunjae-lee eunjae-lee marked this pull request as ready for review August 28, 2020 14:22
@eunjae-lee eunjae-lee requested a review from Haroenv August 28, 2020 14:22
@Haroenv
Copy link
Contributor

Haroenv commented Aug 28, 2020

This seems fine. I guess babel is no option, since it's rollup creating the exports and not babel?

Would we be able to create an entry point which is already cjs to conform to the shape from the start?

@eunjae-lee
Copy link
Contributor Author

This seems fine. I guess babel is no option, since it's rollup creating the exports and not babel?

Would we be able to create an entry point which is already cjs to conform to the shape from the start?

Didn't think of that!
WDYT 304e924 ?

@eunjae-lee eunjae-lee merged commit 24b97e3 into master Aug 31, 2020
@eunjae-lee eunjae-lee deleted the fix/cjs-build branch August 31, 2020 11:50
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.

README instructions are wrong?
2 participants