Add Tokens for Import and Export Names in JS? (Local, Import and Export Names)
See original GitHub issueInformation
- 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
:
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:
- Created 3 years ago
- Comments:14 (14 by maintainers)
Top 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 >
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 Free
Top 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
Thanks @RunDevelopment !
Closed by #2533.