SEARCH BY

All

  • All
  • Java8
  • Spring

Using commonJS and require with import in javascript

Post a Comment
Sometimes we need to use import and require to use any lib in javascript, then here the way to use require along with import

import { createRequire } from "module";
const require = createRequire(import.meta.url);
const si = require("systeminformation"); 
jaya
I love software designing, coding, writing and teaching...

Share this article

Related Posts

Post a Comment

Place your code in <em> </em> tags to send in comments | Do not add hyper links in commnet

Close

Subscribe our newsletter for the latest articles directly into your email inbox