[英]How do I check my condition on an if statement to see if it is working correctly?
[英]How can I check if an import statement is working correctly in the Node 6 REPL?
export default config = {
apiUrl : "http://localhost:7543"
}
$ node --version
v6.7.0
無需轉譯就可以嗎? 有沒有一種方法可以在不更改我的代碼的情況下進行polyfill導入?
我想將其拖入控制台(REPL),然后查看對象是否設置正確。 但:
import {config} from './config';
^^^^^^
SyntaxError: Unexpected token import
看來我還不能在REPL中使用import。 那有什么選擇呢? 我需要使用ES5 / Node require
嗎? 是否可以添加到Nesh的加載程序中的polyfill?
理想情況下,我只想打開node
控制台並在使用import
的行中使用粘貼,而不必更改我的代碼。
Node.js不支持ES模塊。 如果要使用它們,則必須使用Babel轉換代碼。
無法填充ES模塊,因為它們引入了新的語法,因此甚至無法正確解析代碼(您會收到語法錯誤)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.