Add the ability to read module configs from plugin.
See original GitHub issueDescribe 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
- Read the contribution guide.
- Check existing discussions and issues.
Issue Analytics
- State:
- Created 10 months ago
- Comments:14 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I would recommend to anyway use the
app.config.ts
with thevunix
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
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.