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.

Allow users to enhance the Vue app instance in vue 3

See original GitHub issue

This is a follow up to #125

I will need to add another option: enhancePreviewApp.

Here is how you will use it:

// styleguide.config.js
import { defineConfig } from 'vue-styleguidist'

export default defineConfig({
  enhancePreviewApp: 'styleguide/enhanceApp.js' // path of the file you want to define directives in
})
// styleguide/enhanceApp.js
import directive from '@/directives'
import { defineEnhanceApp } from 'vue-styleguidist'

export default defineEnhanceApp((app) => {
  app.directive('directive', directive)
})

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
elevatebartcommented, Oct 3, 2022

@didagu You can skip the function altogether. It was meant to help write the code with the proper types.

It is returning exactly its params without modification.

export default (app) => {
  app.directive('loadable', loadable);
}
1reaction
aleksrecommented, Oct 3, 2022

@elevatebart I can’t seem to get this feature to work. It prints out the error:

Module parse failed: Unexpected token (1:14)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> Copyright (c) silverwind
| All rights reserved.
|

It’s just a normal js file. We already use the renderRootJsx and require options for other files in the same folder and that works as expected, just this one doesn’t work.

The error seems to be linked to actually importing defineEnhanceApp, because it goes away if I remove it without changing anything else and it also comes back if I import defineEnhanceApp from another file (like require.ts) even if I don’t actually use it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a Vue Application - Vue.js
Every Vue application starts by creating a new application instance with the createApp function: js import { createApp } from 'vue' const app...
Read more >
The Benefits of the New Vue 3 App Initialization Code
The new architecture gives us the possibility to have two or more isolated Vue instances that do not share any features by default,...
Read more >
Refactoring your Vue 2 apps to Vue 3 - LogRocket Blog
Now, all the dependencies in the project have been upgraded and are ready to be used. We just need to enable them by...
Read more >
Vue 3 Tutorial (for Vue 2 Users) - Vue.js Developers
Wondering what the key features and changes of Vue 3 are? In this article, I'll highlight them with a walkthrough of a simple...
Read more >
The Complete Guide to Provide/Inject API in Vue 3: Part 1
Get started building plug-ins using Vue 3's Provide/Inject API. Learn about Props, Prop Drilling and how to solve the side effects of Prop ......
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