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(rollup): enable interop: compat for cjs compatibility #215

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

Dunqing
Copy link
Contributor

@Dunqing Dunqing commented Feb 12, 2023

In rollup3, you need to configure interop to compat for cjs to work properly

Previously

const esm = require('esm-lib')
console.log(esm)

Currently

const esm = require('esm-lib')
function _interopDefaultCompat(e) {
	return e && typeof e === 'object' && 'default' in e
		? e
		: { default: e };
}
console.log(_interopDefaultCompat(esm))

@pi0 pi0 changed the title fix(rollup): code generated for cjs is incorrect fix(rollup): enable interop: compat for cjs compatibility Mar 27, 2023
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks!

@pi0 pi0 merged commit 26b8407 into unjs:main Mar 27, 2023
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