我有两个文件:a.js和b.js 我将a导入b。 我将b.js包含在index.html
中即使我仅导出了test
函数而不导出了test2
,为什么test2函数仍运行。
https://codesandbox.io/s/blissful-sun-rrmnx?file=/src/a.js
// a.js
function test(){
alert("Test")
}
function test2(){
alert("test2")
}
test2();
export {test}
// b.js
import { test } from './a.js';
test()