-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(plugin-vue): respect __VUE_PROD_DEVTOOLS__ setting #4984
Changes from 2 commits
9e68255
f894299
3b13f46
f2c2715
c1f5c68
fd4c146
143703a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<template> | ||
<div>Example external component content</div> | ||
</template> | ||
<template> | ||
<div>Example external component content</div> | ||
</template> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import ExampleExternalComponent from './ExampleExternalComponent.vue' | ||
export default ExampleExternalComponent | ||
import ExampleExternalComponent from './ExampleExternalComponent.vue' | ||
|
||
export default ExampleExternalComponent |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "example-external-component", | ||
"private": true, | ||
"version": "0.0.0", | ||
"main": "index.js" | ||
} | ||
{ | ||
"name": "example-external-component", | ||
"private": true, | ||
"version": "0.0.0", | ||
"main": "index.js" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<template> | ||
<ExampleExternalComponent /> | ||
</template> | ||
<script> | ||
import ExampleExternalComponent from 'example-external-component' | ||
export default { | ||
components: { | ||
ExampleExternalComponent | ||
} | ||
} | ||
</script> | ||
<template> | ||
<ExampleExternalComponent /> | ||
</template> | ||
|
||
<script> | ||
import ExampleExternalComponent from 'example-external-component' | ||
|
||
export default { | ||
components: { | ||
ExampleExternalComponent | ||
} | ||
} | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ export async function transformMain( | |
ssr: boolean, | ||
asCustomElement: boolean | ||
) { | ||
const { devServer, isProduction } = options | ||
const { devServer, isProduction, devToolsEnabled } = options | ||
|
||
// prev descriptor is only set and used for hmr | ||
const prevDescriptor = getPrevDescriptor(filename) | ||
|
@@ -58,6 +58,7 @@ export async function transformMain( | |
// inlined template cannot be individually hot updated. | ||
const useInlineTemplate = | ||
!devServer && | ||
!devToolsEnabled && | ||
descriptor.scriptSetup && | ||
!(descriptor.template && descriptor.template.src) | ||
const hasTemplateImport = descriptor.template && !useInlineTemplate | ||
|
@@ -108,7 +109,7 @@ export async function transformMain( | |
if (hasScoped) { | ||
attachedProps.push([`__scopeId`, JSON.stringify(`data-v-${descriptor.id}`)]) | ||
} | ||
if (devServer && !isProduction) { | ||
if (devToolsEnabled || (devServer && !isProduction)) { | ||
// expose filename during serve for devtools to pickup | ||
attachedProps.push([`__file`, JSON.stringify(filename)]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Due to safety concerns, the full path should not be used in production. Please use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, I've just started using |
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems exposing
__file
is enough for the devtool to display the component name, why do you want to disableinlineTemplate
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because for component with script setup, inlineTemplate as true doesn't expose any setup binding. Vue devtools relies on this to display component setup binding correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
I have discussed this with Evan today.
As the
inlineTemplate
option has an impact on the app performance, we believe that it shouldn't be disabled.We need to find another way to fix this issue. Maybe in another package.