serverless-bundle icon indicating copy to clipboard operation
serverless-bundle copied to clipboard

feat: handle externals all-monorepo option

Open maximang opened this issue 3 years ago • 4 comments

maximang avatar Jan 07 '22 14:01 maximang

Thanks for the PR!

I'm wondering, can we do this by default for the all option? Would it error out if we traversed up the directories and looked for a root package.json.

jayair avatar Jan 17 '22 17:01 jayair

Sorry for the late answer, I was in holiday.

I tried using nodeExternals({ additionalModuleDirs: [path.resolve(process.cwd(), "../../node_modules")] }) on a non-monorepo project. I put the project at the top-level directory to be sure it would also work if ../../ doesn't exist. I tested it on Linux and Windows, it worked in both cases.

I will update the PR.

maximang avatar Feb 11 '22 09:02 maximang

Thanks! We have a test case for the externals that's failing. If we can fix that, I can merge it.

jayair avatar Feb 14 '22 17:02 jayair

Test fixed

maximang avatar Feb 15 '22 10:02 maximang