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

Update option docs for --externals (default peerDependencies & dependencies) #636

Merged
merged 2 commits into from
Jun 1, 2020

Conversation

gtrufitt
Copy link
Contributor

Just a small clarification that the externals default is peerDependencies and dependencies.

(Not sure if this is needed as obviously this is a sensible default, but it wasn't clear until checking the code that we didn't need to have externals that mirrored peerDependencies like you might if setting up rollup from scratch)

external = external

Copy link
Owner

@developit developit left a comment

Choose a reason for hiding this comment

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

This is a nice helpful tip!

My only nit would be that I think modules passed via --external are marked as external in addition to deps/peerDeps, rather than those being an overridable default (I may be misremembering).

@gtrufitt
Copy link
Contributor Author

gtrufitt commented Jun 1, 2020

Thanks @developit

So it looks like the default is some stdLib stuff, peerDep and deps.

If the option.external is set then it's the (comma separated) external entries, stdLib and just peerDeps?

The options.entries being the other stickler, which maybe is not important to call out in the default in docs?

Hence, my assumption for a minimal but useful default, if external isn't set, in docs was 'peerDependencies and Dependencies' - but happy to push a change if you think there's more needed?

let external = ['dns', 'fs', 'path', 'url'].concat(
		options.entries.filter(e => e !== entry),
	);
const peerDeps = Object.keys(pkg.peerDependencies || {});
	if (options.external === 'none') {
		// bundle everything (external=[])
	} else if (options.external) {
		external = external.concat(peerDeps).concat(options.external.split(','));
	} else {
		external = external
			.concat(peerDeps)
			.concat(Object.keys(pkg.dependencies || {}));
	}

@wardpeet
Copy link
Collaborator

wardpeet commented Jun 1, 2020

This is great! We might want to show while outputting in verbose mode or something which packages are being externalized but for this PR it looks 👍

@wardpeet wardpeet merged commit a71918b into developit:master Jun 1, 2020
@gtrufitt
Copy link
Contributor Author

gtrufitt commented Jun 1, 2020

👍

@krobing
Copy link

krobing commented Jun 19, 2020

I think the externals added as other more, should be in addition to deps/peerDeps.

My only nit would be that I think modules passed via --external are marked as external in addition to deps/peerDeps, rather than those being an overridable default (I may be misremembering).
-
@developit

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.

4 participants