Skip to content

Commit

Permalink
fix!: output a single, cjs build
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ahuth committed Feb 23, 2024
1 parent f55f9cb commit 523130e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"author": "CZI <edu-frontend-infra@chanzuckerberg.com>",
"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"
Expand Down
26 changes: 8 additions & 18 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <script>, package managers (such as npm or yarn)
Expand Down

0 comments on commit 523130e

Please sign in to comment.