DEV Community

Discussion on: Web Components: from zero to hero

Collapse
 
ahmadchaker profile image
AhmadChaker • Edited

Hi Pascal, I have a few questions. In the github code example for this you have the following index.html:

github.com/thepassle/webcomponents...

I don't understand why you would need import('./to-do-app.js'). You have imported the component at the top and in-fact you have used it already in the html body.
I've stepped through with the debugger and it looks like the constructor of to-do-app.js is not even invoked until after the script is finished, this is despite the fact that the html is already used in the html body!
Can you explain what is happening here?