vue/src/core/instance/index.js中的Vue方法为啥要判断process.env.NODE_ENV !== 'production'
来源:1-5 Vue.js 源码构建

师哈哈
2019-09-11
function Vue (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue)
) {
warn('Vue is a constructor and should be called with the `new` keyword')
}
this._init(options)
}
如上代码中为啥要判断process.env.NODE_ENV !== 'production'
当process.env.NODE_ENV
的值是production的时候是ssr吗?
写回答
1回答
-
ustbhuangyi
2019-09-12
NODE_ENV 在生产环境下的值是 'production',这是在编译的时候设置的,当为 `production` 的时候,上述代码会变成 if(false),然后压缩代码后,if 整个块代码都被删了
00
相似问题