feat: Initial devtools support (#1125)
This commit is contained in:
16
packages/vue/src/dev.ts
Normal file
16
packages/vue/src/dev.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { version, setDevtoolsHook } from '@vue/runtime-dom'
|
||||
|
||||
export function initDev() {
|
||||
const target: any = __BROWSER__ ? window : global
|
||||
|
||||
target.__VUE__ = version
|
||||
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__)
|
||||
|
||||
if (__BROWSER__) {
|
||||
// @ts-ignore `console.info` cannot be null error
|
||||
console[console.info ? 'info' : 'log'](
|
||||
`You are running a development build of Vue.\n` +
|
||||
`Make sure to use the production build (*.prod.js) when deploying for production.`
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
if (__BROWSER__ && __DEV__) {
|
||||
// @ts-ignore `console.info` cannot be null error
|
||||
console[console.info ? 'info' : 'log'](
|
||||
`You are running a development build of Vue.\n` +
|
||||
`Make sure to use the production build (*.prod.js) when deploying for production.`
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
// This entry is the "full-build" that includes both the runtime
|
||||
// and the compiler, and supports on-the-fly compilation of the template option.
|
||||
import './devCheck'
|
||||
import { initDev } from './dev'
|
||||
import { compile, CompilerOptions, CompilerError } from '@vue/compiler-dom'
|
||||
import { registerRuntimeCompiler, RenderFunction, warn } from '@vue/runtime-dom'
|
||||
import * as runtimeDom from '@vue/runtime-dom'
|
||||
import { isString, NOOP, generateCodeFrame, extend } from '@vue/shared'
|
||||
|
||||
__DEV__ && initDev()
|
||||
|
||||
const compileCache: Record<string, RenderFunction> = Object.create(null)
|
||||
|
||||
function compileToFunction(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// This entry exports the runtime only, and is built as
|
||||
// `dist/vue.esm-bundler.js` which is used by default for bundlers.
|
||||
import './devCheck'
|
||||
import { initDev } from './dev'
|
||||
import { warn } from '@vue/runtime-dom'
|
||||
|
||||
__DEV__ && initDev()
|
||||
|
||||
export * from '@vue/runtime-dom'
|
||||
|
||||
export const compile = () => {
|
||||
|
||||
Reference in New Issue
Block a user