How can I import dwg(Autocad format) file into threejs with javascript?

Your topic is actually a duplicate of: Import .dwg in three.js

Importing a DWG file directly into three.js is not possible. You have to convert the file to a different 3D format. Eventually you want to load glTF into your app. So consider to convert to OBJ and then to glTF.