Query about compiling JS assets
Working on an old project using webpack, just for a reference it has a
main.js
file which is importing files from the components folder, pretty standard stuff.
Ive noticed that some of these component files are importing the same package in multiple components E.G.
foo.js
is importing package 1
bar.js
is importing package 1
Ive always wondered if there is a negative impact to this? or are tools like webpack, vite, etc smart enough to only import that package once when compiled?1 Reply
It should be imported once only, all handled by Webpack.