Skip to content

How to use "merge: false" in api.extendPackage #4779

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

Closed
deraw opened this issue Oct 31, 2019 · 2 comments · Fixed by #5149
Closed

How to use "merge: false" in api.extendPackage #4779

deraw opened this issue Oct 31, 2019 · 2 comments · Fixed by #5149

Comments

@deraw
Copy link

deraw commented Oct 31, 2019

Version

4.0.5

Environment info

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
  Binaries:
    Node: 12.1.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.12.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 78.0.3904.70
    Firefox: 70.0
  npmGlobalPackages:
    @vue/cli: 4.0.3

Steps to reproduce

Create a plugin and try to override a field in package.json in a generator.

What is expected?

In the documentation of api.extendPackage(), it is stated that "Nested fields are deep-merged unless { merge: false } is passed."

What is actually happening?

I don't see any part that handles this case in the code, I don't known how to override a field 🙁

@tobyzerner
Copy link

Building a preset and was just wondering this exact thing.

haoqunjiang added a commit that referenced this issue Feb 6, 2020
Currently, 3 options are implemented:

- options.prune (defaults to `false`) - Remove null or undefined
fields from the object after merging.
- options.merge (defaults to `true`) deep-merge nested fields, note
that dependency fields are always deep merged regardless of this option.
- options.warnIncompatibleVersions (defaults to `true`) Output warning
if two dependency version ranges don't intersect.

Closes #4779
@haoqunjiang
Copy link
Member

That comment was outdated documentation referring to an option that was removed long before @vue/cli 3 stable release. It will be added back in the next version.

mactanxin pushed a commit to mactanxin/vue-cli that referenced this issue Feb 11, 2020
…js#5149)

Currently, 3 options are implemented:

- options.prune (defaults to `false`) - Remove null or undefined
fields from the object after merging.
- options.merge (defaults to `true`) deep-merge nested fields, note
that dependency fields are always deep merged regardless of this option.
- options.warnIncompatibleVersions (defaults to `true`) Output warning
if two dependency version ranges don't intersect.

Closes vuejs#4779
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 a pull request may close this issue.

3 participants