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.

Add Tokens for Import and Export Names in JS? (Local, Import and Export Names)

See original GitHub issue

Information

  • Language: JavaScript
  • Plugins: I tried with JS-Extras too

Does the problem still occur in the latest version of Prism? Yes

Description Would it be possible to add tokens for the import and export names in JavaScript? (see patterns below taken from the import examples and export examples in the ECMAScript spec)

See below - currently they are not receiving any tokenization. To be clear, I’m referring to the local names, import names and export names with names such as v, x, v2 and ns:

Screen Shot 2020-08-26 at 10 48 37

Screen Shot 2020-08-26 at 11 00 05

I also tried using the js-extras language as follows, but that didn’t seem to help:

https://codesandbox.io/s/prismjs-forked-wu91d

Code snippet

The code being highlighted incorrectly:

import v from "mod";
import {x as v2} from "mod";
import * as ns from "mod";

export * as ns from "mod";
export {v as x} from "mod";
export {x} from "mod";
export {v as x};
export {x};

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
karlhorkycommented, Aug 28, 2020

Thanks @RunDevelopment !

1reaction
RunDevelopmentcommented, Aug 27, 2020

Closed by #2533.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Export and Import - The Modern JavaScript Tutorial
Export and import directives have several syntax variants. In the previous article we saw a simple use, now let's explore more examples.
Read more >
import - JavaScript - MDN Web Docs - Mozilla
Name of the exports to be imported. The name can be either an identifier or a string literal, depending on what module-name declares...
Read more >
How to import two classes by the same name in javascript/es6?
import Data from 'component/Data. js'; import Data from 'actions/Data. js'; Both files contain a class named Data .
Read more >
16. Modules - Exploring JS
Imports and exports must be at the top level; 16.3.4. ... of the module to be imported. Names ( 'util' ): What modules...
Read more >
Understanding Modules and Import and Export Statements in ...
Modules in JavaScript use the import and export keywords: ... To demonstrate how to use this, update your functions.js file to be a...
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