What is the difference between local and global registration in module system?

Posted by Jennifer | Updated on

What is the difference between local and global registration in module system?

In local registration, you need to create each component in components folder(optional but it is recommended) and import them in another component file components section.

Let’s say you want to register component A and B in component C, the configuration seems as below:

Now both ComponentA and ComponentB can be used inside ComponentC‘s template.

In global registration, you need to export all common or base components in a separate file. But some of the popular bundlers like webpack make this process simpler by using require.context to globally register base components in the below entry file(one-time).


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers