Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7e358da

Browse files
stephankaagfloydspace
andcommitted
fix(esbuild): use absolute path for esbuild entry (#4)
* fix(esbuild): use absolute path for esbuild entry * test: fix unit test Co-authored-by: Victor Korzunin <ifloydrose@gmail.com>
1 parent 6663596 commit 7e358da

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎src/function.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class NodejsFunction extends lambda.Function {
4242
es.buildSync({
4343
...buildOptions,
4444
external: union(exclude, buildOptions.external || []),
45-
entryPoints: [entry],
45+
entryPoints: [path.join(projectRoot,entry)],
4646
outdir: path.join(projectRoot, BUILD_FOLDER, path.dirname(entry)),
4747
platform: 'node',
4848
});

‎tests/function.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Runtime, RuntimeFamily } from '@aws-cdk/aws-lambda';
77
import { Stack } from '@aws-cdk/core';
88
import { buildSync } from 'esbuild';
99
import mockfs from 'mock-fs';
10-
import path from 'path';
10+
import path,{join} from 'path';
1111

1212
import { NodejsFunction } from '../src';
1313

@@ -56,7 +56,7 @@ describe('NodejsFunction tests', () => {
5656
${'a/b/c.h'} | ${'a/b/c.ts'}
5757
`('Should be valid entry with default rootDir', ({ handler, entry }) => {
5858
new NodejsFunction(new Stack(), 'lambda-function', { handler });
59-
expect(buildSync).toHaveBeenCalledWith(expect.objectContaining({ entryPoints: [entry] }));
59+
expect(buildSync).toHaveBeenCalledWith(expect.objectContaining({ entryPoints: [join(process.cwd(),entry)] }));
6060
});
6161

6262
it('Should be valid outdir with custom rootDir', () => {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /