Comments (3)
I thought of 2 possible solutions:
- Since you already know you the packer you will use, you could narrow down the search and only look for the lock file specific to your packer.
a. In my case the issue was clear: it found a location of a yarn.lock file and then tried to callnpm run beforePackage
on it. - Instead of triggering the search multiple times for each individual lock file name, search only 1 time using all of them as valid options for a match.
Instead of:
const findUpIO = (name: string, directory = process.cwd()): IOO.IOOption<string> =>
pipe(path.resolve(directory), (dir) =>
pipe(
safeFileExistsIO(path.join(dir, name)),
IO.chain((exists: boolean) => {
if (exists) return IOO.some(dir);
if (isPathRoot(dir)) return IOO.none;
return findUpIO(name, path.dirname(dir));
})
)
);
/**
* Forwards `rootDir` or finds project root folder.
*/
export const findProjectRoot = (rootDir?: string) =>
pipe(
IOO.fromNullable(rootDir),
IOO.fold(() => findUpIO('yarn.lock'), IOO.of),
IOO.fold(() => findUpIO('pnpm-lock.yaml'), IOO.of),
IOO.fold(() => findUpIO('package-lock.json'), IOO.of),
IOO.toUndefined
)();
Have something like:
const findUpIO = (**names: string[]**, directory = process.cwd()): IOO.IOOption<string> =>
pipe(path.resolve(directory), (dir) =>
pipe(
**array.some(names.map((name) => safeFileExistsIO(path.join(dir, name))))**,
IO.chain((exists: boolean) => {
if (exists) return IOO.some(dir);
if (isPathRoot(dir)) return IOO.none;
return findUpIO(name, path.dirname(dir));
})
)
);
/**
* Forwards `rootDir` or finds project root folder.
*/
export const findProjectRoot = (rootDir?: string) =>
pipe(
IOO.fromNullable(rootDir),
IOO.fold(() => findUpIO(['yarn.lock', 'pnpm-lock.yaml', 'package-lock.json'), IOO.of),
IOO.toUndefined
)();
I know this is a crude solution, and I haven't given much thought and effort into how it would fit into the overall code, but perhaps it will help speed things up and shorten the time it takes to fix this.
from serverless-esbuild.
I can confirm this issue. We spent some time debugging it, and the cause was looking up the directory tree and finding a package-lock.json outside of the repo.
from serverless-esbuild.
🎉 This issue has been resolved in version 1.48.5 🎉
The release is available on:
Your semantic-release bot 📦🚀
from serverless-esbuild.
Related Issues (20)
- serverless website documentation is outdated HOT 1
- Bun support HOT 1
- Unable to serverless package when no lambdas exist HOT 3
- serverless deploy fails without a reason when using esbuild-plugin-tsc HOT 2
- Rewrite Module Packaging Logic HOT 3
- I'm not sure if it supports layers
- pnpm: external modules bundled without their nested modules. HOT 2
- Indirect dependency marked as external missing in package HOT 1
- Slow performance when using external property
- Esbuild cannot rebuild error
- `patterns` not respected at `invoke local`
- sls package fails with individually: true for specific function Error: ENOENT: no such file or directory, copyfile
- update esbuild peerDependency HOT 1
- Support ESBuild 0.20.0 HOT 2
- watch function work with serverless-localstack.
- Possible memory-use regression in v1.48.1 HOT 1
- Stuck on Need a faster logging experience when using serverless-stack with serverless-esbuild HOT 1
- Support Lambda custom runtimes HOT 2
- Trouble importing to esbuild.config.js from an internal monorepo package HOT 1
- Hangs indefinitely on esbuild error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-esbuild.