-
Notifications
You must be signed in to change notification settings - Fork 171
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
Dependency resolving problem with compiled byte code #159
Comments
Could you please provide a complete minimal example that shows the problem with a simple Also, try running the project like this: |
Hi @OsamaAbbas, https://github.com/ishanuda/nestjs-ncc-bytenode NOTE: I have update the README for your reference. Thank you very much. |
Thank you for creating the minimal example. I apologize for the late response, and I will look into it in the weekend. |
Thank you very much, I also updated the commands needed for your reference in case you needed. |
Hi, NOTE: The .env file is mounted in
Thank you |
I can reproduce your error now. However, I don't even know how to approach the problem! There are many parts, each could potentially be the cause, and I have almost no experience with them. I tried to google the error message. There are many people who had the same error but without bytenode. It was all related to nest configurations. I believe that the way bytenode is wrapping your code inside this function I'm sorry I could not help. |
Hi, The thing is, Before the bytecode conversion, the code runs well and it confirmed that the code has no errors. As you suggest, may be the Generally, the TypeORM repository is working as a service and should import in the module before it is used by the service. As you can see the above I did not get the explicit export part you mentioned and if there is any hint that you can provided I can try with the code. Library reference: Thank you |
Neither did I! I tried one thing then I gave up. I started with adding |
Hi, |
Hi @OsamaAbbas, I did import one module at a time in the app module and compiled the code and it works. As you can see in the image I commented the If I try to import all at once the error is giving. Do you have any idea or suggestions about this behavior? Thank you very much. |
@ishanuda don't forgot to export in compiled file as well |
Hi @AwesomeSam9523 , Thank you very much |
require('bytenode');
module.exports = require('./filename.jsc'); |
@AwesomeSam9523 , Thank you very much. |
@ishanuda Hey. I am not very sure about NEST Framework sorry. But what we do in JavaScript/electron is paste that in our entry file. Suppose there is a file I am sorry but not sure how NEST works. If this doesn't help you, please close the issue as I am not the right guy. I just sent that because I was doing same mistake so thought of telling you the solution. |
@AwesomeSam9523 Hi, No worries, I will try what you are suggesting here, But it was good to know this as well. |
Hi,
I tried the library with an app developed using the Nest.JS framework.
Library converted the bundle.js into bytecode and code ran without any errors.
NOTE: bundle.js was built following the bellow step 2.
However, I wanted to try with more advanced cases such as connecting to a database.
I did setup the application to use
sqlite3
along withTypeORM
.Compiled the application into a single bundle using
ncc
library,NTOE:
ncc
library also copied thesqlite3
related node native module to the build folder successfully.Now the library can run as a standalone file and tested and confirmed that I can do CURD operations with the database.
bytenode
and it could generate a compiled bytecode file.When I run the code using
bytenode ./build/bundle.jsc
it throws the error of not resolving the ORM Repository.I could not find any resources/ configurations to solve this issue.
Please help.
Resources:
@nestjs/core: ^8.0.0
sqlite3: ^5.0.2
typeorm: ^0.2.37
@vercel/ncc: ^0.31.1
bytenode: ^1.3.3
typescript: ^4.3.5
Thank you very much
The text was updated successfully, but these errors were encountered: