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.

Cannot parse an SFC that has mixed exports

See original GitHub issue

Current behavior

When you try to parse an SFC that has default export and named export, the library throws an error below.

vue-docgen-api: multiple exports in a component file are not handled by docgen.parse, Please use "docgen.parseMulti" instead

The same error happened when you use parseMulti function.

To reproduce

Code Sandbox: https://codesandbox.io/s/vue-docgen-api-mixed-export-w2xj3

Expected behavior

Parses the file correctly, or throws an appropriate error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ghostcommented, Jan 17, 2020

@elevatebart I believe it should be for the default export.

Let’s say for example I have a radio component which has multiple display types inside an object. In order to make a more dynamic test or extend storybook knobs, I export the object in order to use it in other places as well as within the component.

1reaction
pockacommented, Jan 18, 2020

@elevatebart Thanks for taking a look at this! I tried 4.5.2 which includes the fix for this issue and confirmed it parse SFCs without throwing an error.

But it would be better to not include the named-exported object in the result: just ignoring named-exports is enough since in most cases they are not components, IMO. What do you think?

Also, I noticed the docgen.parse method returns a named-exported object (maybe a first exported object?) instead of default exported component. (Sandbox)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Props table is broken when using more exports in file (vue)
It was that vue-docgen-api cannot parse mixed exports in SFC, as @Aaron-Pool said. I filed an issue on docgen-api repo ...
Read more >
Typescript Vue class-based components throwing error ...
I'm using Laravel Mix to compile my Vue components and for it, I used TypeScript and class-based components. Every single class is exported...
Read more >
@vue/compiler-sfc | Yarn - Package Manager
Just use the main vue/compiler-sfc deep import instead. This package contains lower level utilities that you can use if you are writing a...
Read more >
How We Refreshed Our Vue 2 JavaScript Codebase ... - Medium
How we created and maintain a TypeScript / JavaScript hybrid Vue.js codebase for a smooth and progressive transition.
Read more >
sf.pdf
x an object of class sf, sfc or sfg that has mixed geometry (GEOMETRY or GEOMETRYCOLLECTION). type character; one of "POLYGON", "POINT", " ......
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