简体   繁体   中英

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. 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.

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

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';

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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