DEV Community

Cover image for How to use require() in ECMAScript modules
Eranda K.
Eranda K.

Posted on

How to use require() in ECMAScript modules

Liquid syntax error: Unknown tag 'endraw'

Top comments (3)

Collapse
 
leejjon_net profile image
Leejjon

Aren't you forgetting the export before the line in example 01?

Like

//multiple.js
export const multiple = (num1, num2) => {
  return num1 * num2;
};

Enter fullscreen mode Exit fullscreen mode
Collapse
 
sixman9 profile image
Richard Joseph

For me at least, this is an amazing find, specifically the createRequire( ) call.

Life safer, thank you 🙏🏾

Collapse
 
aye_city_3fc1ea22d87c56e7 profile image
AYE CITY

lol, now it module is not defined n es module scope