I am unable to import a module from a TypeScript @types package.
In my main file I have:
import { BdApi } from 'bandagedbd__bdapi'
console.log(BdApi)
This compiles correctly when I run tsc but not with node build.js.
My tsconfig looks like this:
"compilerOptions": {
"target": "es6",
"module": "es6",
"moduleResolution": "node"
}
And my build.js file:
const browserify = require('browserify');
const tsify = require('tsify');
const babelify = require('babelify');
browserify()
.add('src/main.ts')
.plugin(tsify)
.transform(babelify, { extensions: ['.ts', '.tsx'] })
.bundle()
.on('error', function (error) { console.error(error.toString()); })
.pipe(process.stdout);
And my .babelrc
{
"presets": ["@babel/preset-env"]
}
And the output when running node build.js
Error: Cannot find module 'bandagedbd__bdapi' from 'C:\Users\...\src'
I can import * as React from 'react' from @types/react, but not import { BdApi } from 'bandagedbd__bdapi'.
I am unable to import a module from a TypeScript @types package.
In my main file I have:
This compiles correctly when I run
tscbut not withnode build.js.My tsconfig looks like this:
And my build.js file:
And my .babelrc
{ "presets": ["@babel/preset-env"] }And the output when running
node build.jsI can
import * as React from 'react'from@types/react, but notimport { BdApi } from 'bandagedbd__bdapi'.