Skip to content

TypeError: FacebookConversionAPI is not a constructor #3

Description

@OliverJEvans

Description

When using package in an ES module, I get the following error:
TypeError: FacebookConversionAPI is not a constructor

When not using in an module, wit.h const instead of import, then the code works as expected.

Expected

No error when using ES import syntax 😄

Code

import http from 'http';
import FacebookConversionAPI from '@rivercode/facebook-conversion-api';

const FBConversionAPI = new FacebookConversionAPI(xxxxx);

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Versions

Node.js v17.8.0
FacebookConversionAPI v1.1.8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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