Skip to content

Conversation

@TotalTechGeek
Copy link
Contributor

@TotalTechGeek TotalTechGeek commented Mar 27, 2022

Rollup Plugin Name: node-resolve

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:
#1150

Description

Currently, the resolveOnly property allows you to pass in an array of strings or regular expressions to validate if a module should be bundled in.

I had a use case where I wanted to bundle in everything except for certain dependencies. (node-rdkafka, sqlite3).

I've extended the resolveOnly property to allow developers more control. With this PR, it should be possible to pass in a function into nodeResolve to override the check that takes place, thus allowing something like the following:

function forbid (...modules) {
    const set = new Set(modules)
    return module => !set.has(module)
}

nodeResolve({
    resolveOnly: forbid('sqlite3', 'node-rdkafka')
})

Copy link
Member

@tjenkinson tjenkinson left a comment

Choose a reason for hiding this comment

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

Lgtm! I think the empty array behaviour is the same but just wanted to double check

@shellscape
Copy link
Collaborator

thanks!

@shellscape shellscape merged commit f561ec1 into rollup:master Apr 11, 2022
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