ES6 module no export Terminal
See original GitHub issueWhen 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:
- Created 3 years ago
- Reactions:9
- Comments:19 (3 by maintainers)
Top 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 >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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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.
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.