Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(iife): MISSING_NAME_OPTION_FOR_IIFE_EXPORT is output even if nothing is exported from the entrypoint#2256

Merged
hyf0 merged 3 commits into
rolldown:mainfrom
shulaoda:fix/missing-name-option-for-iife-export
Sep 18, 2024
Merged

fix(iife): MISSING_NAME_OPTION_FOR_IIFE_EXPORT is output even if nothing is exported from the entrypoint#2256
hyf0 merged 3 commits into
rolldown:mainfrom
shulaoda:fix/missing-name-option-for-iife-export

Conversation

@shulaoda
Copy link
Copy Markdown
Member

@shulaoda shulaoda commented Sep 18, 2024

Description

closes #2255

The main improvements include adding a check for hasExports and altering some of the structural writing, which makes the code clearer.

The following are the conditions for warning in Rollup.

if (hasExports && !name) {
	log(LOGLEVEL_WARN, logMissingNameOptionForIifeExport());
}

At present, there is no clue about reexports.

const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
let hasExports = renderedExports.length > 0;
let hasDefaultExport = false;
for (const renderedDependence of renderedDependencies) {
	const { reexports } = renderedDependence;
	if (reexports?.length) {
		hasExports = true;
		if (!hasDefaultExport && reexports.some(reexport => reexport.reexported === 'default')) {
			hasDefaultExport = true;
		}
		if (format === 'es') {
			renderedDependence.reexports = reexports.filter(
				// eslint-disable-next-line unicorn/prefer-array-some
				({ reexported }) => !renderedExports.find(({ exported }) => exported === reexported)
			);
		}
	}
}

@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 18, 2024

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 0bbf89b
🔍 Latest deploy log https://app.netlify.com/sites/rolldown-rs/deploys/66ea9cfd12c0d9000847fe93

Comment thread crates/rolldown/src/ecmascript/format/utils/namespace.rs Outdated
Copy link
Copy Markdown
Contributor

@7086cmd 7086cmd left a comment

Choose a reason for hiding this comment

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

LGTM

@7086cmd 7086cmd requested a review from underfin September 18, 2024 09:05
Copy link
Copy Markdown
Member

@hyf0 hyf0 left a comment

Choose a reason for hiding this comment

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

Nice!

@hyf0 hyf0 added this pull request to the merge queue Sep 18, 2024
Merged via the queue into rolldown:main with commit c0e7b5f Sep 18, 2024
@shulaoda shulaoda deleted the fix/missing-name-option-for-iife-export branch September 18, 2024 12:59
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.

[Bug]: MISSING_NAME_OPTION_FOR_IIFE_EXPORT is output even if nothing is exported from the entrypoint

3 participants