Skip to content

Issues to run with Node #483

@nicolaslevy

Description

@nicolaslevy

When building I'm having issues to make it work with Node.

Example:

import { VASTClient } from '../../dist/vast-client-node.js';

const vastClient = new VASTClient();

async function parseSimpleInline() {
    const parsedVast = await vastClient.get("https://statics.dmcdn.net/h/html/vast/simple-inline.xml");
    // eslint-disable-next-line no-console
    console.log(parsedVast);
}

await parseSimpleInline();

In particuar:
Looks like there is a window when using Node

> node index.js

/home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/vast-client-node.js:2807
      throw new Error(data.error);
            ^

Error: ReferenceError: window is not defined
    at Fetcher.fetchVAST (/home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/vast-client-node.js:2807:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.18.0

And after fixing that issue, I had otehr issue with XMLDom and Rollup: xmldom/xmldom#316

> node index.js

node:internal/modules/cjs/loader:1225
  const err = new Error(message);
              ^

Error: Cannot find module './dom'
Require stack:
- /home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/chunks/xmldom-ac2d7d04.js
- /home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/vast-client-node.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/chunks/xmldom-ac2d7d04.js:3:11)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/chunks/xmldom-ac2d7d04.js',
    '/home/nicolas/Develop/workspace_summer2025/vast-client-js/dist/vast-client-node.js'
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions