framework icon indicating copy to clipboard operation
framework copied to clipboard

Add the ability to read module configs from plugin.

Open Vinccool96 opened this issue 2 years ago • 6 comments

Describe the feature

Right now, there's no way to get a module options defined in nuxt.config.ts.

The only way currently is to write nuxt.config.ts like this:

import { defineNuxtConfig } from "nuxt/config"
import MyModule from ".."

const config = {
  foo: "bar",
  toto: "tata",
}

export default defineNuxtConfig({
  modules: [MyModule ],
  moduleConfig: config,

  runtimeConfig: {
    public: {
      moduleConfig: config,
    },
  },
})

It is extremely redundant. And it's made even worse if MyModule has default properties, because they will not be put in the runtime config.

Additional information

  • [ ] Would you be willing to help implement this feature?
  • [ ] Could this feature be implemented as a module?

Final checks

Vinccool96 avatar Nov 19 '22 21:11 Vinccool96