From 523130ed29e411e6ef5d9add27f8b78c2736f88a Mon Sep 17 00:00:00 2001 From: Andrew Huth Date: Fri, 23 Feb 2024 15:33:06 -0500 Subject: [PATCH] fix!: output a single, cjs build Supporting both cjs and esm is painful. esm is the future, but let's simplify the EDS build for now, and then update to esm at some point in the future. --- package.json | 6 ++---- rollup.config.mjs | 26 ++++++++------------------ 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index e96d827d8..0c82411d4 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,9 @@ "author": "CZI ", "homepage": "https://github.com/chanzuckerberg/edu-design-system", "license": "MIT", + "type": "commonjs", "exports": { - ".": { - "import": "./lib/index.js", - "require": "./lib/index.cjs" - }, + ".": "./lib/index.js", "./index.css": "./lib/index.css", "./fonts.css": "./lib/tokens/fonts.css", "./tailwind.config": "./tailwind.config.ts" diff --git a/rollup.config.mjs b/rollup.config.mjs index e17e385ac..17f30ec50 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -7,24 +7,14 @@ import postcss from 'rollup-plugin-postcss'; */ export default { input: 'src/index.ts', - output: [ - { - dir: 'lib', - format: 'es', - preserveModules: true, - preserveModulesRoot: 'src', - sourcemap: true, - }, - { - dir: 'lib', - format: 'cjs', - preserveModules: true, - preserveModulesRoot: 'src', - sourcemap: true, - entryFileNames: '[name].cjs', - interop: 'auto', - }, - ], + output: { + dir: 'lib', + format: 'cjs', + preserveModules: true, + preserveModulesRoot: 'src', + sourcemap: true, + interop: 'auto', + }, /** * With the nodeResolve plugin, this marks all EDS node_modules as external, aka provided by the consumer. * Since EDS is not imported directly into a web