Open samrith-s opened 3 years ago
What does the relevant import look like in apps/hello/lambda.js
that is bringing this dependency in?
I was guessing it would be https://github.com/nestjs/nest/blob/8c503d3193059f40632df7378d5091ea8ef6b13d/packages/core/nest-application.ts#L34-L38 which would mean a configuration to allow misses like:
jetpack:
trace:
allowMissing:
"@nest/core":
- "@nest/microservices"
- # ... etc ...
... which is usually how this ends.
But it looks like your application entry point has the optional require, which I'm guessing isn't the case but rather with an entry point name dist/apps/hello/lambda.js
it looks like you're also bundling your application code + dependencies with a bundler like webpack/rollup/esbuild or something?
If so, if you're bundling with a tool you don't need jetpack just use the tool to create a single lambda bundle and completely ignore node_modules
and really all files except your output bundle. If not, then I'd need to know more about what your code is doing.
Hey, yeah I am using NestJS to bundle everything into my lambda. So it is basically embedding everything into my file, but I just need to ignore these optional modules. I will try with the allowMissing
option and let you know.
Thanks for taking the time to respond! :)
allowMissing
only works at the npm package level, so given that you've got dist/../lambda.js
outside of node_modules
, I don't think it's going to work. We'd have to take a look at re-tooling https://github.com/FormidableLabs/trace-deps to expand allowMissing
to include relative application source paths.
Backing up, do you need to trace dist/apps/hello/lambda.js
or does it have all of its dependencies contained already? What actual files have require()
s that you need to trace and include other files with?
There's a chance that your packaging solution is just something like:
include:
- "!**" # exclude everything
- "dist/apps/hello/**/*.js" # keep all built hello app JS files
without using Jetpack trace mode (instead using either jetpack normal mode (trace: false|unset
) or vanilla serverless packaging)
It contains all of the dependencies already.
This is my jetpack config:
jetpack:
collapsed:
bail: true
concurrency: 4
preInclude:
- '!**'
trace:
dynamic:
bail: true
I need to include a particular node module, but exclude certain files. I am at a loss at how to do this.
Also, I set trace
to false
and still got this error with this config:
jetpack:
collapsed:
bail: true
concurrency: 4
preInclude:
- '!**'
trace: false
Just leave the trace
field off completely and you'll get the same thing. What's your packages.NAME
config look like and what is the node_module
you need full-path-wise?
Hmm, I do not have any packages.NAME
config. And I need to include @prisma/cli
(but only parts of it) something like this https://github.com/ryands17/serverless-prisma/blob/master/serverless.yml#L33-L36
And when I use Jetpack to package, this is my activity monitor: And this is my terminal:
Edit: This went on for over 5 minutes, with my laptop's fans blazing with no progress. I am at a complete loss on how to build my app.
Hello,
I am trying to bundle my NestJS app using Jetpack. I get this error:
I need Jetpack to ignore this as the module is a dynamic dependency of NestJS and is not actually consumed by my application. How do I make this work?