In JavaScript it work But in typescript 'module not found'
const addon = require('../build/Debug/addon')
console.log(addon.helloworld()) //Hello World
I try this three syntax
import * as addon from '..../build/Debug/addon'
// Also
import * as addon from '..../build/Debug/addon.node'
// Also
import addon = require('..../build/Debug/addon')
Typescript compile to
module.exports = ..../build/Debug/addon
tsconfig.json
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": true,
"module": "commonjs",
"target": "es2020",
"allowJs": true,
}
}