1. Take advantage of tree Shaking when es module is automatically introduced
//util.js
export const aaa => {
console.log('aaa')}export const bbb => {
console.log('bbb')}//index.js
import { aaa } from 'util.js'
aaa()
-----------------------------------------------
// tree shaking is not triggered when exporting a complete object.
export default {
aaa: () = > {
console.log('aaa')}bbb: () = > {
console.log('bbb')}}//index.js
import utrl from 'util.js'
utrl.aaa()
Copy the code