What are the two uses of import?

usage one:

// main.js
import bar from "bar.js"
import "foo.js"
console.log(bar)

//foo.js
import bar from "bar.js"
bar.foo = "foo"

//bar.js
export default bar

usage 2:

// main.js
import bar from "foo.js"
console.log(bar)

//foo.js
import bar from "bar.js"
bar.foo = "foo"
export default bar

//bar.js
export default bar

what are the main differences between the two packaged webpack? How should I choose?

Oct.11,2021

there should be no difference. Webpack loads import in a certain order when packing. It will not be loaded repeatedly, as long as it does not refer to each other

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b4202b-2be30.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b4202b-2be30.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?