question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES6 module no export Terminal

See original GitHub issue

When I follow the doc to import Terminal as an ES6 module.

The recommended way to load xterm.js is via the ES6 module syntax:

import { Terminal } from 'xterm';

I got the following error. I opened the xterm.js and found it’s an minified js file and it indeed didn’t export Terminal.

The requested module '../../../node_modules/xterm/lib/xterm.js' does not provide an export named 'Terminal'

I’m not using any building tools. I just used plain ES6 import syntax.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:19 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
justinfagnanicommented, Sep 5, 2020

Is there any chance of moving to native modules in a major release? Every current major browser, and the past 3 major (soon to be 4 next moth) of Node, supports modules natively.

@Tyriar

then you lose support for other better supported ways of importing. Eventually we’ll move there but shipping a library that supports many different import types is tricky.

I don’t think there are better ways of importing than native modules. Every other way requires tools or userland loaders, and can be targeted with native modules and a tool anyway.

At this point I really don’t think it’d even be worth it to publish two packages. Applications that support older browsers can really easily consume JS module dependencies and compile them to a different format. It’s the default behavior for Rollup and Webpack.

One problem with not publishing standard JS modules is that you library is shut off from those that are using native modules. I’m trying to use a terminal widget for a project, but all my libraries are modules only, and there’s no good way to import UMD from native modules.

3reactions
elgscommented, Apr 29, 2020

This is a big deal, because with the REAL ES6 support, the client can get rid of the dependency of build tools, though the build tools are awesome, but at least it’s not necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6 import gives Unexpected Identifier SyntaxError when ...
This will allow you to use ES modules in Node.js without the need to transpile the import/export statements. node --experimental-modules .
Read more >
ES6 Modules and How to Use Import and Export in JavaScript
You can export members one by one. What's not exported won't be available directly outside the module: export const myNumbers = [ ...
Read more >
How to use an ES6 import in Node.js? - GeeksforGeeks
The import statement is used to import modules that are exported by some ... by typing node –experimental-modules index.js in the terminal.
Read more >
Bountysource
ES6 module no export Terminal.
Read more >
Understanding module.exports and exports in Node.js
As JavaScript originally had no concept of modules, ... The System.register format was designed to support ES6 modules within ES5.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found