What is the correct way to introduce a common library using vue?

I am developing a project with nuxt.js.

I unify the common js into the utility class / util.js

then I
import {loadScript} from"~ / util"

in each vue page

as a result, it is found that each vue is completely packaged with util.js, instead of just loadScript.

excuse me, why is this?

Apr.19,2021

individual export methods are:
export function loadScript () {}
or

function loadScript(){}
export {loadScript}

you can post the export of util.


change utils.js to a folder, and then store it according to the file.

import loadScript from '~/util/loadScript'
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-1b3ac50-2c233.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-1b3ac50-2c233.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?