Skip to content

Commit

Permalink
fix(devtools): load Vue devtools lazily (#4946)
Browse files Browse the repository at this point in the history
* fix: load devtools lazily closes #4943

* fix: lazy load the devtools dep to force it out of production bundle
  • Loading branch information
logaretm authored Nov 20, 2024
1 parent 14122af commit 30281f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-spoons-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vee-validate": patch
---

fix: lazy load the devtools dep to force it out of production bundle
6 changes: 3 additions & 3 deletions packages/vee-validate/src/devtools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { App, ComponentInternalInstance, getCurrentInstance, nextTick, onUnmounted, toValue, unref } from 'vue';
import { setupDevtoolsPlugin } from '@vue/devtools-api';
import type { InspectorNodeTag, CustomInspectorState, CustomInspectorNode } from '@vue/devtools-kit';
import { PathState, PrivateFieldContext, PrivateFormContext } from './types';
import { keysOf, setInPath, throttle } from './utils';
Expand Down Expand Up @@ -33,9 +32,10 @@ let SELECTED_NODE:
*/
let API: any;

function installDevtoolsPlugin(app: App) {
async function installDevtoolsPlugin(app: App) {
if (__DEV__) {
setupDevtoolsPlugin(
const devtools = await import('@vue/devtools-api');
devtools.setupDevtoolsPlugin(
{
id: 'vee-validate-devtools-plugin',
label: 'VeeValidate Plugin',
Expand Down

0 comments on commit 30281f5

Please sign in to comment.