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.

Support Dynamic Import

See original GitHub issue

The version of ESLint you are using. Latest

The problem you want to solve. I want to use ESLint and Webpack without babel-ESLint, but due to the lack of support for dynamic import, which Webpack uses to determine where to split code, I must use babel-eslint where I would otherwise be happy without transpiling.

Your take on the correct solution to problem. According to https://github.com/eslint/eslint#what-about-experimental-features, it states:

ESLint’s parser only officially supports the latest final ECMAScript standard. We will make changes to core rules in order to avoid crashes on stage 3 ECMAScript syntax proposals (as long as they are implemented using the correct experimental ESTree syntax)

I believe this is a case that warrants an exception to this rule given the prominence of import in otherwise bland es5 code due to Webpack. import is stage 3, fully 262 tested, battle tested in all browsers, mandated by the html standard and firmly ensconced in the bundling ecosystem.

The proposed fix is to support dynamic support in ESLint now ahead of stage 4, especially considering it has an unknown timeline to advance to stage 4.

Are you willing to submit a pull request to implement this change? Yes 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:12
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

44reactions
aladdin-addcommented, Jun 4, 2019

import() has reached stage-4, seems we can support it now!

7reactions
ljharbcommented, Mar 8, 2019

The difference, however, is that this one is shipped in almost all the browsers, which imo makes it objectively, not subjectively, important.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript modules: dynamic import() - CanIUse
"Can I use" provides up-to-date browser support tables for support of front-end web ... Loading JavaScript modules dynamically using the import() syntax.
Read more >
Advanced Features: Dynamic Import - Next.js
Dynamically import JavaScript modules and React Components and split your code ... Next.js supports lazy loading external libraries with import() and React ...
Read more >
import() - JavaScript - MDN Web Docs - Mozilla
The import() syntax, commonly called dynamic import, is a function-like expression that ... (Static import only supports static specifiers.) ...
Read more >
How to Dynamically Import ECMAScript Modules
You can import modules dynamically if you use import as a function — import(pathToModule) — a feature available starting ES2020.
Read more >
Dynamic imports - The Modern JavaScript Tutorial
Export and import statements that we covered in previous chapters are called “static”. The syntax is very simple and strict.
Read more >

github_iconTop Related Medium Post

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