What is the correct syntax for importing JSNLog using ES6?

我是研究僧i 提交于 2020-01-04 02:45:29

问题


I can't seem to figure out how to import JSNLog into my ES6 (babel) based Aurelia project. I've tried:

import 'jsnlog';            // JL is undefined
import JL from 'jsnlog';    // JL is {}
import {JL} from 'jsnlog';  // JL is undefined

If it matters I've learned that the jsnlog.js file is generated from typescript source.


回答1:


The author has fixed this issue with the v2.17.1 release.




回答2:


I am the author of JSNLog.

Just added info to the jsnlog.com site about using ES6 import to import JSNLog into an ES6 NodeJs application: http://jsnlog.com/Documentation/HowTo/LoadingJsFile#es6 (using Babel as the transpiler).

This uses:

import {JL} from 'jsnlog';



回答3:


According to this line from the source code the following

import {JL} from 'jsnlog';

should work. At least, it works for me.

If it doesn't, check out your SystemJS setup. The issue will be somewhere there.



来源:https://stackoverflow.com/questions/35684035/what-is-the-correct-syntax-for-importing-jsnlog-using-es6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!