Skip to content

Commit

Permalink
fix(bundling): respect --sourcemap option for esbuild (#15778)
Browse files Browse the repository at this point in the history
(cherry picked from commit 7d9352e)
  • Loading branch information
jaysoo authored and FrozenPandaz committed Mar 23, 2023
1 parent b05f540 commit 53ba54f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
8 changes: 7 additions & 1 deletion docs/generated/packages/esbuild/executors/esbuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@
"default": false
},
"sourcemap": {
"type": "boolean",
"oneOf": [
{
"type": "string",
"enum": ["linked", "inline", "external", "both"]
},
{ "type": "boolean" }
],
"alias": "sourceMap",
"description": "Generate sourcemap.",
"default": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,39 @@ describe('buildEsbuildOptions', () => {
},
});
});

it('should set sourcemap', () => {
expect(
buildEsbuildOptions(
'esm',
{
bundle: false,
platform: 'node',
main: 'apps/myapp/src/index.ts',
outputPath: 'dist/apps/myapp',
tsConfig: 'apps/myapp/tsconfig.app.json',
project: 'apps/myapp/package.json',
outputFileName: 'index.js',
assets: [],
singleEntry: true,
sourcemap: true,
external: [],
},
context
)
).toEqual({
bundle: false,
entryNames: '[dir]/[name]',
entryPoints: ['apps/myapp/src/index.ts'],
format: 'esm',
platform: 'node',
outdir: 'dist/apps/myapp',
tsconfig: 'apps/myapp/tsconfig.app.json',
external: undefined,
sourcemap: true,
outExtension: {
'.js': '.js',
},
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function buildEsbuildOptions(
target: options.target,
metafile: options.metafile,
tsconfig: options.tsConfig,
sourcemap: options.sourcemap,
format,
outExtension: {
'.js': outExtension,
Expand Down
2 changes: 2 additions & 0 deletions packages/esbuild/src/executors/esbuild/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface EsBuildExecutorOptions {
esbuildOptions?: Record<string, any>;
external?: string[];
format?: Array<'esm' | 'cjs'>;
generatePackageJson?: boolean;
main: string;
metafile?: boolean;
minify?: boolean;
Expand All @@ -20,6 +21,7 @@ export interface EsBuildExecutorOptions {
outputPath: string;
platform?: 'node' | 'browser' | 'neutral';
project: string;
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
skipTypeCheck?: boolean;
target?: string;
thirdParty?: boolean;
Expand Down
5 changes: 4 additions & 1 deletion packages/esbuild/src/executors/esbuild/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
"default": false
},
"sourcemap": {
"type": "boolean",
"oneOf": [
{ "type": "string", "enum": ["linked", "inline", "external", "both"] },
{ "type": "boolean" }
],
"alias": "sourceMap",
"description": "Generate sourcemap.",
"default": false
Expand Down

0 comments on commit 53ba54f

Please sign in to comment.