liquidjs icon indicating copy to clipboard operation
liquidjs copied to clipboard

liquid.node.esm.js breaks in module context

Open wyozi opened this issue 1 year ago • 2 comments

Hi, I'm trying to use liquidjs in a esm project. However, it fails in runtime with this error: ReferenceError: require is not defined in ES module scope, you can use import instead

The culprit seems to be this line in the built liquid.node.esm.js dist: const requireResolve = require.resolve; (that's line 1479 in v.10.16.4)

Using node version 21

wyozi avatar Aug 27 '24 09:08 wyozi

Please try v10.16.5, added some checks for the demo cases including esm scenario.

More complex scenarios like in-browser rendering is not checked in real browsers yet. Will do latter, but not seeing too many ppl come across issues in browsers.

harttle avatar Aug 27 '24 16:08 harttle

Thanks, seems to work now

wyozi avatar Sep 23 '24 08:09 wyozi