In the scope of vue entry files import css and import js files

Why does the introduction of css style files work globally? And the introduction of js files can only work under the current module?
main.js

import a from "./a.js";
//
import "./index.css"

a.js

export default "hello world"

index.css

.title{
    color:red
}

Styles introduced in

main.js are globally available.

import a from'. / a.jsgiving;

to introduce js, you need to use:

Vue.prototype.$hello = a;
/ / so that it can be accessed directly in the subcomponent using this.$hello.
"hello world"

the css introduced in main.js is global. The introduced js file only works in main.js, because main.js is a module in webpack, and a.js is also a module, which cannot be accessed elsewhere, which is the modularization of ES6, so if you want the a.js to be globally available, you need to bind to the global object, such as binding Vue, to expose the a to the global object.

Menu