Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

extendPlugin not available in module or wrong docs #1932

Closed
cimchd opened this issue Apr 24, 2020 · 4 comments
Closed

extendPlugin not available in module or wrong docs #1932

cimchd opened this issue Apr 24, 2020 · 4 comments

Comments

@cimchd
Copy link

cimchd commented Apr 24, 2020

Version

v2.12.2

Reproduction link

https://nuxtjs.org/api/internals-module-container

Steps to reproduce

In https://nuxtjs.org/api/internals-module-container there are several functions listed that should be available in a ModuleContainer.

However the extendPlugins function is not available

// inside a module

// not working
console.log(this.extendPlugins); // => undefined

// working
console.log(this.extendBuild); // => [Function: extendBuild] 
console.log(this.extendRoutes); // => [Function: extendRoutes]

I also checked all other functions from the docs, but they are working as expected.

So I am not sure: Are the docs wrong or is the extendPlugins function missing?

What is expected ?

extendPlugins available in a nuxt module in this context

or

extendPlugins function should not be listed in the docs.

What is actually happening?

extendPlugins is listed as function in a nuxt module in the docs but is not available

This bug report is available on Nuxt community (#c10564)
@pi0
Copy link
Member

pi0 commented Apr 24, 2020

Hi @cimchd you are reading docs wrong ;) extendPlugins is a configuration: https://nuxtjs.org/api/configuration-extend-plugins

For adding plugins to module you can either directly push/unshift to this.nuxt.options.plugins or Provide plugins: https://nuxtjs.org/guide/modules#provide-plugins

@pi0 pi0 closed this as completed Apr 24, 2020
@cimchd
Copy link
Author

cimchd commented Apr 24, 2020

Hi @cimchd you are reading docs wrong ;) extendPlugins is a configuration: https://nuxtjs.org/api/configuration-extend-plugins

For adding plugins to module you can either directly push/unshift to this.nuxt.options.plugins or Provide plugins: https://nuxtjs.org/guide/modules#provide-plugins

@pi0 Thank you for your answer.

I understand the docs that here: https://nuxtjs.org/api/internals-module-container#extendplugins-fn- extendPlugin() is listed as a method of the ModuleContainer class.
I know that it is also available as a configuration, but how I understand the docs it should also be a method of ModuleContainer class.

I have already solved my problem (with addPlugin), just wanted to let you know that the api docs do not provide the right or at least misleading information.

@pi0 pi0 reopened this Apr 24, 2020
@pi0 pi0 transferred this issue from nuxt/nuxt Apr 24, 2020
@pi0
Copy link
Member

pi0 commented Apr 24, 2020

Sorry @cimchd I missed docs part for internals. Seems docs related to nuxt/nuxt#6285 wrongly added by #1698 as a module container which is wrong. I moved the issue to the corresponding repo.

@debs-obrien
Copy link
Contributor

Thanks for your contributions. We are now closing this repo as docs have now moved to nuxtjs.org using content module. Please continue your contributions on that site especially focusing on the guides folder which is the new docs. Thanks

https://github.com/nuxt/nuxtjs.org/blob/master/README.md

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants