Are components cached when imported multiple times?
[issue link]Hi. I would like to know if when I import
the same component in 2 different pages, will it load 2 times or once?
example:
~/pages/page1:
import SomeComponent from "~/components/SomeComponent.js";
export default {
components: { SomeComponent }
}
~/pages/page2:
import SomeComponent from "~/components/SomeComponent.js";
export default {
components: { SomeComponent }
}
When I go from /home
(server-loaded) to /page1
(client-loaded, redirected with router), and redirect from /page1
to /page2
(also client-loaded, redirected with router), will the SomeComponent load more than once? Will it need to download the additional bytes?
If yes, then should I put the SomeComponent in ~/plugins/myComponents.js and make it global by doing Vue.use(SomeComponent) there? So that it’s loaded only once by client