-
Notifications
You must be signed in to change notification settings - Fork 29
Nest.js: Unable to import #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the heads up, it looks like Nest.js doesn't yet support ES Modules: nestjs/nest#8736 (also see nestjs/nest#7021) The good news is that it's a quick fix for you - you can tell it to explicitly use the CommonJS dist instead: const { getLatLngObj } = require("tle.js/dist/tlejs.cjs"); I verified this works by running their TypeScript starter project and outputting some test code in their import { Injectable } from '@nestjs/common';
const { getLatLngObj } = require("tle.js/dist/tlejs.cjs");
const tle = `ISS (ZARYA)
1 25544U 98067A 17206.18396726 .00001961 00000-0 36771-4 0 9993
2 25544 51.6400 208.9163 0006317 69.9862 25.2906 15.54225995 67660`;
@Injectable()
export class AppService {
getHello(): string {
return `Hello World! ${JSON.stringify(getLatLngObj(tle))}`;
}
} |
Okay, thanks for the info and the "temporary" solution. |
Great, glad that works! I am seeing a similar error with a simple Node project so I think I may be packaging it a bit wrong as well, looking into this! |
In tle.js |
Unfortunately when I try to import this version with TypeScript into my Nest.js project, that fails with a "Can't find module declaration or corresponding type declaration" (Even my IDE (vs-code) shows this...). Additionally the other way you described before now gives an error:
|
Oof, thanks for the heads up, I'm not sure what's going on there. As a workaround you'll have to lock it down to the prior version for now ( |
Yes, that's what I did already. |
When you have a chance, please try again with |
Okay, I tested it. |
Woo! Good stuff, thanks for your patience! |
@davidcalhoun can you close this? |
Sounds good, closing this out! |
Problem
Compilation fails when using tle.js with nest.js:
Workaround
Remove the
"type": "module",
line from the package.jsonSolution
I don't know (yet). Maybe remove the line and everything would be fine? Or does that cause other problems?
The text was updated successfully, but these errors were encountered: