microsoft / microsoft/TypeScript
Dynamic import breaks global onError with requirejs
Open
@rbuckton is already working on this.
Since Jun 26, 2019.
Needs Investigation
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.2.2
Search Terms: dynamic import, requirejs, amd, onerror
Code
import('module').then(()=>{ /* some code*/ });
compiled to
new Promise(function (resolve_1, reject_1) {
require(['module'], resolve_1, reject_1);
});
If require are called with 3 arguments then require.onError is not fired. Reject should be adeed only in case when we have a catch call after import.
Some propose:
//@ts-import-no-reject
import('module').then(()=>{ /* some code*/ });
new Promise(function (resolve_1) {
require(['module'], resolve_1);
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.