mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-05-17 03:59:37 +03:00
fix: auto install plugin in browser
This commit is contained in:
@@ -85,6 +85,7 @@ function rollupConfig({
|
||||
// replaceConfig needs to have some values
|
||||
'const polyfill = process.env.NODE_ENV === \'test\'': 'const polyfill = true',
|
||||
'process.env.VERSION': `"${version}"`,
|
||||
'process.client' : isBrowserBuild ? 'true' : 'false',
|
||||
'process.server' : isBrowserBuild ? 'false' : 'true',
|
||||
/* remove unused stuff from deepmerge */
|
||||
// remove react stuff from is-mergeable-object
|
||||
|
||||
@@ -5,6 +5,7 @@ import { setOptions } from './shared/options'
|
||||
import $meta from './shared/$meta'
|
||||
import generate from './server/generate'
|
||||
import { hasMetaInfo } from './shared/meta-helpers'
|
||||
import { isUndefined } from './utils/is-type'
|
||||
|
||||
/**
|
||||
* Plugin install function.
|
||||
@@ -25,6 +26,14 @@ function install (Vue, options) {
|
||||
Vue.mixin(createMixin(Vue, options))
|
||||
}
|
||||
|
||||
if (process.client) {
|
||||
// automatic install
|
||||
if (!isUndefined(window) && !isUndefined(window.Vue)) {
|
||||
/* istanbul ignore next */
|
||||
install(window.Vue)
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
version,
|
||||
install,
|
||||
|
||||
Reference in New Issue
Block a user