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.

Don't wrap import() expression

See original GitHub issue

Source:

export function moduleLoadCallback() {
    return import(/* webpackChunkName: "a" */ "./a.module")
        .then(function (module) { return module.A; });
}

TS Out:

export function moduleLoadCallback() {
    return import(/* webpackChunkName: "a" */ "./a.module")
        .then(function (module) { return module.A; });
}

TsickleOut:

export function moduleLoadCallback() {
    return (import)(/* webpackChunkName: "a" */ "./a.module")
        .then(function (module) { return module.A; });
}

https://github.com/webpack/webpack/issues/5859

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
alexeaglecommented, Oct 26, 2017

angular 5 no longer produces generated .ts code, it is all compiled in one pass. this is because we now use a better architecture with TypeScript transformers. There is no option to go back to .ts codegen.

It sounds like using annotationsAs: "decorators" might be a workaround for you?

I agree that tsickle processing shouldn’t wrap the import keyword in parens.

0reactions
Delagencommented, Jul 23, 2019

Angular use now import() for lazy load so this seems fixed now

Read more comments on GitHub >

github_iconTop Results From Across the Web

wrapper function with es6 import without needing a variable ...
Thanks, but I don't want to wrap the exported object because I may want to pass some options to the wrapper that will...
Read more >
Dynamic imports - The Modern JavaScript Tutorial
The import() expression. The import(module) expression loads the module and returns a promise that resolves into a module object that ...
Read more >
Add flag to not transpile dynamic `import()` when module is ...
Since Node 12, it is possible to use dynamic imports. Yet I'm not able to tell the TS compiler to not transpile this...
Read more >
ES2020: `import()` – dynamically importing ES modules - 2ality
The ECMAScript proposal “ import() ” by Domenic Denicola is at stage 4 and part of ECMAScript 2020. It enables dynamic loading of...
Read more >
Python import: Advanced Techniques and Tips
The Python import system is as powerful as it is useful. In this in-depth tutorial, you'll learn how to harness this power to...
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