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.

Considerations for import absolute-first when using ES2020 Dynamic imports?

See original GitHub issue

I would assume the use case for dynamic imports.

IE:

import("foo").then( foo => {} )

Would be more likely used throughout the body of the document as opposed to being constrained to the head of the document considering the nature of code splitting.

Would it be possible to ignore import first in cases where import is followed by then?

Going off of: https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
joshchernoffcommented, Nov 24, 2020

Thanks for the help, that looks to have addressed my concerns.

1reaction
ljharbcommented, Nov 24, 2020

Yes. You’ll need an ecmaVersion of 2020 in parserOptions, or to use babel-eslint as your parser.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ECMAScript - Introducing Dynamic Imports in ES2020 (ES11)
Introducing the "Dynamic Import" proposal, arriving with new import() keyword enabling to load a module on demand at runtime, which has been ...
Read more >
ES2020: `import()` – dynamically importing ES modules - 2ality
The operator is used like a function: The parameter is a string with a module specifier that has the same format as the...
Read more >
How to use Dynamic Imports in ES2020 - DEV Community ‍ ‍
This means that rather than importing all your potentially necessary files at the top of your file, you can just import files based...
Read more >
JavaScript modules: dynamic import() - CanIUse
Loading JavaScript modules dynamically using the import() syntax. Usage % of. all users, all tracked, tracked desktop, tracked mobile.
Read more >
Exploring ES2020 features - Dynamic Import - Kamal Sharif
The module specifier can be specified by using the template literal too. This increases the flavor of dynamic importing. For example, we can...
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