在我的应用程序中使用 webpack 并且不能使用 javascript 的 typeof 指令
Using webpack in my application and can't use javascript's typeof directive
所以每次我尝试使用 typeof 时,就像下面的例子
window.clone = function clone(obj){
if(obj === null || (typeof obj) !== 'object')
return obj;
var temp = new obj.constructor();
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
};
它抛出这个错误
Cannot find module '@babel/runtime/helpers/typeof'
这太荒谬了。在这种情况下我能做什么?
提前致谢。
npm install --save-dev @babel/runtime
对我有用 :)
来源:
所以每次我尝试使用 typeof 时,就像下面的例子
window.clone = function clone(obj){
if(obj === null || (typeof obj) !== 'object')
return obj;
var temp = new obj.constructor();
for(var key in obj)
temp[key] = clone(obj[key]);
return temp;
};
它抛出这个错误
Cannot find module '@babel/runtime/helpers/typeof'
这太荒谬了。在这种情况下我能做什么? 提前致谢。
npm install --save-dev @babel/runtime
对我有用 :)
来源: