From 85e2d75f306fdb36417f76f289559f0194440808 Mon Sep 17 00:00:00 2001 From: Kevin Nielsen Date: Wed, 3 May 2023 11:52:08 -0700 Subject: [PATCH] ENG-0000 - Added commonjs variants Because jest chokes on esm and nothing is every really easy --- package.json | 4 ++-- rollup.config.js | 5 +++++ scripts/buildEntryPointPackages.ts | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index ae7b69da..c23b8a4d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@al/core", - "version": "2.0.0-beta.3", + "version": "2.0.0-beta.4", "description": "Node Enterprise Packages for Alert Logic (NEPAL) Core Library", - "main": "./bundles/al-core-nucleus.esm2015.js", + "main": "./bundles/al-core-nucleus.es5.js", "types": "./types/al-core-nucleus.d.ts", "module": "./bundles/al-core-nucleus.esm2015.js", "author": { diff --git a/rollup.config.js b/rollup.config.js index 7e0e7917..51088702 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -25,6 +25,11 @@ function configureEntryPoint( bundleName, directory ) { file: `bundles/al-core-${bundleName}.esm2015.js`, format: 'esm', // Keep the bundle as an ES module file sourcemap: true, + }, + { + file: `bundles/al-core-${bundleName}.es5.js`, + format: 'cjs', // Keep the bundle as a common JS module file + sourcemap: true, } ], external, diff --git a/scripts/buildEntryPointPackages.ts b/scripts/buildEntryPointPackages.ts index 142459f8..ed8e43ea 100644 --- a/scripts/buildEntryPointPackages.ts +++ b/scripts/buildEntryPointPackages.ts @@ -30,7 +30,7 @@ async function buildPackage( entryPoint:string ) { if ( entryPoint !== 'nucleus' ) { const packageJson = { name: `@al/core/${entryPoint}`, - main: `../bundles/al-core-${entryPoint}.esm2015.js`, + main: `../bundles/al-core-${entryPoint}.es5.js`, module: `../bundles/al-core-${entryPoint}.esm2015.js`, typings: `../types/al-core-${entryPoint}.d.ts` };