output.sourcemap = !!process.env.SOURCE_MAP
output.banner = banner
output.externalLiveBindings = false
- output.globals = { vue: 'Vue' }
+ output.globals = { vue: 'Vue', '@vue/devtools-api': 'VueDevtoolsApi' }
const isProductionBuild = /\.prod\.js$/.test(output.file)
const isGlobalBuild = format === 'global'
// during a single build.
hasTSChecked = true
- const external = ['vue']
+ const external = ['vue', '@vue/devtools-api']
const nodePlugins = [resolve(), commonjs()]
}
}
+// to support multiple router instances
+let routerId = 0
+
export function addDevtools(app: App, router: Router, matcher: RouterMatcher) {
// Take over router.beforeEach and afterEach
+ // increment to support multiple router instances
+ const id = routerId++
setupDevtoolsPlugin(
{
- id: 'Router',
+ id: 'Router' + id ? ' ' + id : '',
label: 'Router devtools',
app,
},
api.notifyComponentUpdate()
})
- const navigationsLayerId = 'router:navigations'
+ const navigationsLayerId = 'router:navigations:' + id
api.addTimelineLayer({
id: navigationsLayerId,
- label: 'Router Navigations',
+ label: `Router${id ? ' ' + id : ''} Navigations`,
color: 0x40a8c4,
})
})
})
- const routerInspectorId = 'router-inspector'
+ const routerInspectorId = 'router-inspector:' + id
api.addInspector({
id: routerInspectorId,
- label: 'Routes',
+ label: 'Routes' + id ? ' ' + id : '',
icon: 'book',
treeFilterPlaceholder: 'Search routes',
})