简体   繁体   中英

can i use normal javascript code if in that code imported some module

So in my code it gives me error FunctionOfMainJs is not defined which is function made of main.js so what can i do for run normal js code and also use import in same file

main.js

import {CreateDropDown} from "./asset/js/customdropdown.js";

new CreateDropDown([{"ImagePath":null,"OptionValue":"text1"}],"Container");

function FunctionOfMainJs(){
    alert("hey guys");
}

FunctionOfMainJs();

Are you trying to call this function in another.js file? If so you will need to export the function:

module.exports = {FunctionOfMainJS}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM