D
D
DemonCyborg2019-10-23 10:10:09
JavaScript
DemonCyborg, 2019-10-23 10:10:09

Using import in index.js in webpack without export in import file, why does it work?

I am new to webpack and component architecture. I'm also learning JavaScript at the same time. The question is, I have an index.js in which I import component scripts using the import. But in component scripts, I don't use export. However, all scripts work. I can't understand why. Node.js has not yet been studied, webpack has been configured by tutorial articles and videos.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2019-10-23
@DemonCyborg

https://learn.javascript.ru/import-export
The crystal ball suggests that perhaps some global variables are declared in the imported component scripts. This is best avoided, as the whole point of modules and webpack is to avoid globals. What is used in the module is what is used in it import.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question