Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
fix(externals): issue when no one-amex key
Browse files Browse the repository at this point in the history
  • Loading branch information
JAdshead committed Sep 14, 2023
1 parent cd83ead commit 2676bda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,13 @@ describe('bundle-external-fallbacks', () => {
expect(console.error).toHaveBeenCalledWith('Failed to build fallback for external awesome for browser', error);
expect(console.error).toHaveBeenCalledWith('Failed to build fallback for external awesome for node', error);
});

it('does not fail when no one-amex config', async () => {
readPackageUpSync.mockImplementationOnce(() => ({
packageJson: {},
}));

await bundleExternalFallbacks();
expect(esbuild.build).not.toHaveBeenCalled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const getExternalLibraryName = (name, version) => [EXTERNAL_PREFIX, snakeCase(na
*/
export const bundleExternalFallbacks = async () => {
const { packageJson } = readPackageUpSync();
const { 'one-amex': { bundler = {} } } = packageJson;
const { 'one-amex': { bundler = {} } = {} } = packageJson;
const { requiredExternals } = bundler;

if (
Expand Down

0 comments on commit 2676bda

Please sign in to comment.