fix(replace): ignore values option when pass an empty value
Rollup Plugin Name: plugin-replace
This PR contains:
- [x] bugfix
- [ ] feature
- [ ] refactor
- [ ] documentation
- [ ] other
Are tests included?
- [x] yes (bugfixes and features will not be merged without tests)
- [ ] no
Breaking Changes?
- [ ] yes (breaking changes will not be merged unless absolutely necessary)
- [x] 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:
Description
The values option is used for separating with other options, but if you passed a empty value, like null, undefine, 0, false may cause a unexpected replacements.
{
plugins: [
replace({
preventAssignment: true,
values: isDev
? undefined // Dot not pass any replacements in dev
: {
"old value": "new value",
},
})
]
}
Thanks for the PR. To truly protect and assert against breaking changes, this needs to have a new test (it can be a duplicate with a small change like you've done in the PR) to prove that the existing tests don't break. Please revert your test changes in this PR and add a new test that proves your changes to the values handling.
@yuuk last call before this is closed as abandoned
Closing as abandoned.