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.

registration[1] is not a function

See original GitHub issue

Got a problem because of #2144. setTimeout to promise.resolve().then(...) means macro task to micro task, but the micro task will run immediately in script. When trying to get register, the firstNamedDefine can’t be got, because it has been destroyed. So this error ‘registration[1] is not a function’ occurs. The timeline likes:

execute scripnt -> register named module -> clear firstNamedDefine -> script’s load event triggered -> get register -> firstNamedDefine is null

It’ll be reproduce by running only running the test suit ‘Named System.register’.

I wonder if there’s necessary to clear the firstNameDefined by delay? This process seems OK(maybe):

execute script -> register named module -> update firstNamedDefine -> script’s load event triggered -> get register -> clear firstNamedDefine -> execute script -> …

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
joeldenningcommented, Jun 1, 2021

I don’t know whether 6.9.0 fixed typescript bundles using the outFile option.

1reaction
guybedfordcommented, Jan 19, 2021

@joeldenning thanks for following up on this. What you’re suggesting actually does sound like exactly the right approach actually. Perhaps we can turn this into an execComplete hook where the default implementation calls getRegister, something like:

// script-load.js
script.addEventListener('load', function (s) {
  System.execComplete(s.url);
})

It does seem like this gets around the original problem we wanted the timeout for entirely since we can clear everything on completion of all the defines.

Note that we would need to ensure the hook also is called for the eval extension and worker cases as well.

Let me know if that sounds like an approach further, and happy to jump in too as necessary. The replication makes all the difference here so thanks @liajoy for the details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: registration[1] is not a function · Issue #2016 - GitHub
1 and modifying our project to use importmap, I received two different errors. “Unable to resolve bare specifier”; “registration[1] is not a ......
Read more >
systemjs/systemjs - Gitter
x.x - TypeError: registration[1] is not a function - you can see the github ... I thought that the type=system-js-module style of modules...
Read more >
Imported module default.register is not a function
The default export looks like an (obsolete) wrapper function. You might need to "unwrap" it first: import AppDispatcherWrapper from '.
Read more >
Quick Guide to Banner Self-Service Registration
This means that you are not yet registered for the course. You will need to click Submit to register for the course. The...
Read more >
502.306 Denial, suspension, and revocation of securities ...
a. The registration statement as of its effective date or before the effective date in the case of an order denying effectiveness, an...
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