简体   繁体   English

使用ES6导入JSNLog的正确语法是什么?

[英]What is the correct syntax for importing JSNLog using ES6?

I can't seem to figure out how to import JSNLog into my ES6 (babel) based Aurelia project. 我似乎无法弄清楚如何将JSNLog导入我的基于Aurelia项目的ES6(babel)。 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. 如果重要的话我已经知道jsnlog.js文件是从typescript源生成的。

作者已使用v2.17.1版本修复了此问题

I am the author of JSNLog. 我是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). 刚刚向jsnlog.com网站添加了关于使用ES6导入将JSNLog导入ES6 NodeJs应用程序的信息: http ://jsnlog.com/Documentation/HowTo/LoadingJsFile#es6(使用Babel作为转换器)。

This uses: 这用于:

import {JL} from 'jsnlog';

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. 如果没有,请查看您的SystemJS设置。 The issue will be somewhere there. 问题将出现在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM