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.

[FEATURE] Support dynamic import

See original GitHub issue

Support dynamic import :

https://developers.google.com/web/updates/2017/11/dynamic-import

module.js :

export const foo = _ => {
  console.log('foo');
}

main.js :

const main = async _ => {

  const m = await import('module.js');
  m.foo();

  (await import('module.js')).foo();

}

main();

Should display :

foo
foo

The thing is about supporting ‘export’ and ‘import’ keywords.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:21
  • Comments:30 (7 by maintainers)

github_iconTop GitHub Comments

7reactions
ChadKillingsworthcommented, May 7, 2021

This is fully supported as of the 20210505 version

6reactions
dtruffautcommented, Jul 20, 2019

Most of JS developers now use Rollup instead of Closure Compiler.

Rollup does a great job in handling await import instructions and moving all your imports at the same level on the disk.

As a result, code splitting leads to faster load times.

File size matters, but code splitting really is on another level. The benefits are impressive.

In addition, Rollup understands ESNext and respects property names, which leads to fewer bugs.

As of July 2019, I would recommend Rollup over Closure Compiler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Features: Dynamic Import - Next.js
Dynamically import JavaScript modules and React Components and split your code into manageable chunks.
Read more >
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 >
[Feature] Support dynamic imports via plugins #700 - GitHub
My suggestion to support dynamic imports with only a little extra API surface would be to instead yield the generation of an intermediary ......
Read more >
Dynamic import() - V8 JavaScript engine
Dynamic import () introduces a new function-like form of import that caters to those use cases. import(moduleSpecifier) returns a promise for the ...
Read more >
What are Dynamic Imports and how to use them? - Initialyze
Dynamic imports or Code Splitting is the practice of breaking up your JavaScript modules into smaller bundles and loading them dynamically ...
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