diff --git a/build/webpack.dist.locale.config.js b/build/webpack.dist.locale.config.js index 1cef488..b324d74 100644 --- a/build/webpack.dist.locale.config.js +++ b/build/webpack.dist.locale.config.js @@ -22,6 +22,14 @@ module.exports = { libraryTarget: 'umd', umdNamedDefine: true }, + externals: { + vue: { + root: 'Vue', + commonjs: 'vue', + commonjs2: 'vue', + amd: 'vue' + } + }, plugins: [ new webpack.DefinePlugin({ 'process.env': { diff --git a/src/locale/lang.js b/src/locale/lang.js index 62929e0..a07fe6e 100644 --- a/src/locale/lang.js +++ b/src/locale/lang.js @@ -1,11 +1,16 @@ // using with vue-i18n in CDN /*eslint-disable */ +import Vue from 'vue'; +const isServer = Vue.prototype.$isServer; + export default function (lang) { - if (typeof window.iview !== 'undefined') { - if (!('langs' in iview)) { - iview.langs = {}; + if (!isServer) { + if (typeof window.iview !== 'undefined') { + if (!('langs' in iview)) { + iview.langs = {}; + } + iview.langs[lang.i.locale] = lang; } - iview.langs[lang.i.locale] = lang; } }; /*eslint-enable */ \ No newline at end of file -- libgit2 0.21.4