Import not working on Node.js version 11.8.0

后端 未结 3 1726
刺人心
刺人心 2021-01-06 05:24

I am writing a simple program that uses a object full of dictionary words. I want to import that object from a different file as it is very large. When trying to import it I

3条回答
  •  天涯浪人
    2021-01-06 05:48

    You try this. Hope it helps

    const 'your_variable' = require('your_required_module or file_path')
    

    In your case

    const  dict = require( './words_dictionary')
    

提交回复
热议问题