How to use external npm package

I want to use this npm package
window = {};
pm.sendRequest(“”, (error, response) => {
var text = response.text();
(new Function(text))();

        (response) => {
        (error) => {

But this didn’t work and shows me this error ReferenceError: module is not defined
I also tried this code
const imagebase64 = pm.environment.get(“imagebase64”);

(new Function(imagebase64))();


this is also showing me this error SyntaxError: Unexpected token '}'

Please anyone help me with this

1 Like

You need to use eval to run the code you have fetched from

Here is a tutorial I did a while back demonstrating this concept.

I hope this helps. If you get stuck, let me know.

1 Like

I’ll check it out