未捕获的RangeError:超出了最大调用堆栈大小
该错误在这里和其他地方都得到了很好的记录,我知道吸气剂的确在不断地反复调用自己。
但是使用以下Webpack配置,相同的import Foundation
protocol TestProtocol: class {
var firstClosure: () -> () { get set }
var secondClosure: () -> () { get set }
func testFunction()
}
extension TestProtocol {
func testFunction() {
_ = firstClosure
_ = secondClosure
}
}
class A: TestProtocol {
var firstClosure: () -> ()
var secondClosure: () -> ()
var number = 0
init() {
print(number)
firstClosure = {
self.number = 1
}()
print(number)
secondClosure = {
self.number = 2
}()
print(number)
testFunction()
print(number)
}
}
let a = A()
代码不会与默认的create-react-app
Webpack setup无限循环。我的Webpack配置缺少什么?
Klass
index.js
class Klass {
constructor() {
this.alreadyCame = !!this.clientId;
}
get clientId() {
const clientId = Cookie.get(Cookie.cookies.client);
if (clientId !== undefined) {
return decode(clientId);
}
else {
this.clientId = uuid();
return this.clientId;
}
}
set clientId(value) {
if (value !== undefined) {
Cookie.set(Cookie.cookies.client, encode(value), Cookie.duration.long);
}
}
}
export default new Klass();
webpack.config.development.js