stub `prototype` and `optionMergeStrategies` for vue3 compat
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 285
- Forks
- 33
- Avg merge
- 22h 38m
- Merged PRs (30d)
- 3
Description
Environment
- Operating System:
Linux - Node Version:
v14.18.1 - Nuxt Version:
2.16.0-27285136.ab1c6cb4 - Package Manager:
yarn@1.22.17 - Bundler:
Webpack - User Config:
plugins,bridge,target,ssr,buildModules - Runtime Modules:
- - Build Modules:
@nuxt/bridge@3.0.0-27286006.a08b435
Reproduction
https://codesandbox.io/s/gracious-wildflower-g27zf
Describe the bug
The vueApp provided by nuxtApp in a plugin doesn't mock all vue properties, which make some libraries fail. I encountered so far prototype (with VueTailwind, as in the reproduction above) and config.optionMergeStrategies (with VueApollo).
Additional context
--- a/node_modules/@nuxt/bridge/dist/runtime/app.plugin.mjs
+++ b/node_modules/@nuxt/bridge/dist/runtime/app.plugin.mjs
@@ -23,7 +23,8 @@ export default (ctx, inject) => {
vueApp: {
component: Vue.component.bind(Vue),
config: {
- globalProperties: {}
+ globalProperties: {},
+ optionMergeStrategies: Vue.config.optionMergeStrategies
},
directive: Vue.directive.bind(Vue),
mixin: Vue.mixin.bind(Vue),
@@ -33,7 +34,8 @@ export default (ctx, inject) => {
use (vuePlugin) {
vuePlugin.install(this)
},
- version: Vue.version
+ version: Vue.version,
+ prototype: {}
},
provide: inject,
globalName: 'nuxt',
fixed it for me.
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated runtime file node_modules/@nuxt/bridge/dist/runtime/app.plugin.mjs and trace it back to the corresponding source in the bridge repository. Run the linked CodeSandbox reproduction to confirm the missing vueApp properties and verify that VueTailwind and VueApollo no longer fail when both properties are exposed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100