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.

is it possible to get 'import * as ..' syntax?

See original GitHub issue

Hi! First, many thanks, I discovered import-js yesterday and it made me 100% more happy.

I wonder if it possible to get that import declaration syntax:

import * as actions from './actions'

And, is there by any chance a possibility to get:

import * as { getTodos } from './actions'

without explicitly specify getTodos in namedExports?

Thanks

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
trotzigcommented, Mar 6, 2017

Reopening sounds like a good plan. I have the same FUD, but it might just be one of those things you have to write down in code once before it all becomes clear.

0reactions
trotzigcommented, Nov 27, 2017

While I personally try to stay away from wildcard imports, I don’t see why this couldn’t be added to import-js.

Since editor plugins are responsible for extracting the variable, you’d have to make some changes to them. We’ve actually been discussing letting the importjs process extract the variable, and only have the editor plugins tell us the location of the cursor (x, y). If you start there, you’d only have to change the code to extract the current word/variable once. Also, as a side-effect, the cursor approach would enable us to be smarter about resetting the cursor after replacing the file contents.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
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 >
JavaScript Import Explained - Tutorials - Yax.com
Export syntax. Module authors must export features before the code can be used with an import statement. Only features that are marked for...
Read more >
Understanding Modules and Import and Export Statements in ...
The ECMAScript 2015 specification introduced modules to the JavaScript language, which allowed for the use of import and export statements.
Read more >
Understanding ES6 Modules (Import / Export Syntax) in ...
Basically the import and export syntax is used everywhere where we write JavaScript and then transcompile and bundle it to “old-school” ...
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