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

feat(externals): add option to disable packing of external modules #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

feat(externals): add option to disable packing of external modules #119

wants to merge 1 commit into from

Conversation

mattjennings
Copy link
Contributor

Adds an additional configuration option packExternals which will disable installing & bundling modules listed as external.

This is useful for if you want to exclude externals from esbuild but you don't need them installed & packed separately. My use-case was with serverless-offline as externals can be imported normally from node_modules, leading to a faster build. Another use-case could be if you're using lambda layers.

@floydspace
Copy link
Owner

Hi @mattjennings, thank you for your PR.

The package specified in the exclude option is passed to esbuild as external, but it is not included in the function bundle either.

we already have the option exclude, will it cover your use case?

what can we do extra is making exclude option accept boolean values, so if it is true it excludes everything set as external. I have the reason for this: having set exclude and packExternals does not make sense together (exclude would have no effect), so it is why we can keep only one option, but I need second eyes from @olup on it.

@mattjennings
Copy link
Contributor Author

Ah yes, I hadn't considered the exclude option. I agree, finding a way to use exclude is a better idea. A boolean might be fine, otherwise maybe allowing pattern matching or * as a value to designate excluding everything.

@floydspace
Copy link
Owner

floydspace commented Apr 20, 2021

maybe allowing pattern matching or * as a value to designate excluding everything

also works for me 👍, please also describe it in the readme if you gonna make the fix.

@vamche
Copy link
Contributor

vamche commented Aug 2, 2021

@floydspace @mattjennings I've opened #167 for pattern matching. Could you please give it a look?

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