question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the ability to read module configs from plugin.

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Atinuxcommented, Dec 19, 2022

I would recommend to anyway use the app.config.ts with the vunix key, this way you don’t have to handle HMR yourself.

It is also possible to type it so users can get auto-completion: https://nuxt.com/docs/guide/directory-structure/app-config#manually-typing-app-config

1reaction
Atinuxcommented, Dec 19, 2022

I would instead let the user define it like we do for the app/router.options.ts if you want it to be customisable on the application side.

The main question is, do the module really need this informations if it’s about giving it back to the app-side?

In that case, the app.config.ts can also do perfectly the job.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Config Plugins - Expo Documentation
Expo config plugins mostly come from Node modules, you can install them ... Once you add a few plugins, your app.config.js code can...
Read more >
Writing a Plugin - Cypress Documentation
The Plugins API allows you to hook into and extend Cypress behavior. Note: This document assumes you have read the Plugins Guide. ......
Read more >
Reading dll.config (not app.config!) from a plugin module
1- open app.config file in visual studio. 2- in the "configuration" tag add your configurations ...
Read more >
plugin-cfg.xml file - IBM
The plugin-cfg.xml file contains configuration information that determines how the web server plug-in forwards requests.
Read more >
Module | webpack - JS.ORG
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found