runtimeConfig is empty in plugins
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v14.18.1
- Nuxt Version:
2.16.0-27358576.777a4b7f
- Package Manager:
yarn@1.22.17
- Builder:
webpack
- User Config:
privateRuntimeConfig
,publicRuntimeConfig
,plugins
,bridge
,buildModules
- Runtime Modules:
-
- Build Modules:
@nuxt/bridge@3.0.0-27495976.e31c604
Reproduction
Old configuration: https://codesandbox.io/s/hardcore-dream-07bz0n?file=/nuxt.config.js
New configuration: https://codesandbox.io/s/peaceful-williamson-vddeiq?file=/nuxt.config.js
Describe the bug
I’ve just copied the example from https://github.com/nuxt/framework/pull/4254, created new plugin and page, which prints config values in console. It logs nothing in plugin (plugins/plugin.js) but outputs public values at runtime (see pages/index.js)
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:9 (4 by maintainers)
Top Results From Across the Web
runtimeConfig is empty in plugins #9 - nuxt/bridge - GitHub
runtimeConfig is empty in plugins #9 ... It logs nothing in plugin (plugins/plugin.js) but outputs public values at runtime (see ...
Read more >vue.js - Nuxt privateRuntimeConfig access inside Plugin
I created a .env file where i wrote my variables and made sure that is ignored in my .gitignore file. In nuxt.config.js I...
Read more >Runtime Config · Nuxt Advanced
For this to work, you must have a fallback value (which can just be an empty string) defined in your nuxt.config . Example:...
Read more >Systems Manager Command document plugin reference
Provides time zone information when no time zone information is included in your log's timestamp. If this parameter is left blank and if...
Read more >next.config.js: Runtime Configuration
Place any server-only runtime config under serverRuntimeConfig . Anything accessible to both client and server-side code should be under publicRuntimeConfig ...
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 FreeTop 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
Top GitHub Comments
In old format plugins with $config from context it still dont work on client. On server its there but on client its not which breaks a lot of modules that coudl work https://codesandbox.io/s/immutable-fast-eypbmn?file=/plugins/plugin.js:0-33
work for me, i use
setup syntax
and i think runtimeConfig it’s just
nitro
only , whenbridge : { nitro : false }
,will show error, It would be better if there was more detailed documentation or just tell users not to do this