簡體   English   中英

具有ES2015 babel預設的木偶不起作用

[英]Marionette with ES2015 babel preset dont work

我正在將Webpack與babel-loader es2015 ,並且已預先設置了es2015 ,但遇到了這個問題:當包含Marionette(v.2.4.3) es2015預設時, 請將 /lib/core/backbone.marionette.js:26中的this agrument 更改undefined代替this 但是此參數采用root變量( 第10行 ),他看到undefined參數(不是this )並輸出錯誤。

我看到,在es2015預設中包括babel-plugin-transform-es2015-modules-commonjs ,在包含babel-plugin-transform-strict-mode ,它響應嚴格模式並關閉es6模塊。

我試圖修改es2015插件,將require("babel-plugin-transform-es2015-modules-commonjs")更改為[require("babel-plugin-transform-es2015-modules-commonjs"), {"strict": false}] ,但此步驟無法幫助我解決問題。

誰知道,“木偶es2015babel-loader預設的es2015或我es2015問題,以及如何解決?

我解決了我的問題。 我的解決方案是在modules-commonjs中允許頂層使用。

babel-preset-es2015require("babel-plugin-transform-es2015-modules-commonjs")更改為[require("babel-plugin-transform-es2015-modules-commonjs"), { allowTopLevelThis: true }]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM