Skip to content

Building a Node project using Esbuild and Typescript.  #76

@seivan

Description

@seivan

Might be related to #67
But I am having some issues using cld in a Node project using esbuild and Typescript.

$ yarn run make                                                                                  
✘ [ERROR] Could not resolve "./build/Release/cld"

    .yarn/unplugged/cld-npm-2.9.0-8b7667576b/node_modules/cld/index.js:2:21:
      2 │ const cld2 = require('./build/Release/cld');

Not sure if the path is being used relative to my cwd (since that's wrong) or if something is missing in the <modules_folder>/build/Release folder?

$ ls                                                                                     
cld-c.a    cld.node   obj.target

These are the files there.
It only happens when compiling using esbuild. Doesn't happen with ts-node for instance.

This is how I run it

esbuild src/main.ts --bundle --sourcemap --platform=node --target=ES2022 --outfile=build/dist/main.js

This is how I import it

import { detect } from "cld"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions