Skip to content

Conversation

@posva
Copy link
Collaborator

@posva posva commented Nov 21, 2020

the warn function in Vue 3 adds a stacktrace so I think it's worth for library authors to be able to use it. However, it doesn't exist in Vue 2 (there is Vue.util.warn, but it doesn't have a stacktrace)

Because of this I thought of adding warn to vue-demi, but maybe a better place would be the composition-api directly 🤔 @pikax

Screen Shot 2020-11-21 at 12 55 34

@antfu
Copy link
Member

antfu commented Nov 21, 2020

I agree it's better to have this in the plugin directly, but would console.warn enough for printing stacktrace? See vue-next doing a bit more complex

https://github.com/vuejs/vue-next/blob/eb2ae44d94fe71f93cbabc5e049f03f422db48b0/packages/runtime-core/src/warning.ts#L33-L72

@posva
Copy link
Collaborator Author

posva commented Nov 21, 2020

We don't have the stacktrace info available publicly in vue@2 and I wonder if it can be added

@pikax
Copy link

pikax commented Nov 22, 2020

I agree with this being added to the composition-api plugin

@posva
Copy link
Collaborator Author

posva commented Nov 22, 2020

Ok! I will move it to composition api next week then

@posva posva closed this Nov 22, 2020
This was referenced Nov 23, 2020
@posva
Copy link
Collaborator Author

posva commented Nov 23, 2020

PR at vuejs/composition-api#596

@posva posva deleted the feat/warn branch November 23, 2020 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants