Skip to content

long import breaks build #146

@stephen-harris

Description

@stephen-harris

I got this error when trying to build a typescript project using @ovotech/castle:

node_modules/@ovotech/castle/node_modules/@ovotech/avro-kafkajs/dist/AvroTransformBatch.d.ts:4:23 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.
4 import * as Long from 'long';

Using node 20.5.1 and typescript 5.1.6 with esModuleInterop enabled in tsconfig.json.

I think its related to this issue. If I replace the offending line:

import * as Long from 'long';

with

import Long = require('long');

The build completes

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