Skip to content

Commit

Permalink
Convert commonjs code to esm during build (primer#2150)
Browse files Browse the repository at this point in the history
* Build theme-preval to esm

* Use default export for theme-preval

* Create sweet-elephants-end.md

* Update theme-preval snapshot
  • Loading branch information
dgreif authored Jun 30, 2022
1 parent 9299d23 commit 63a2de5
Show file tree
Hide file tree
Showing 7 changed files with 3,258 additions and 3,230 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-elephants-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

Ensure all files in `lib-esm` are in fact esm and not CommonJS
6 changes: 5 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = {
development: {
presets: makePresets(process.env.BABEL_MODULE || false),
plugins: [
...(process.env.BABEL_MODULE === 'commonjs' ? ['@babel/plugin-transform-modules-commonjs'] : []),
...(process.env.BABEL_MODULE === 'commonjs'
? ['@babel/plugin-transform-modules-commonjs']
: [
'transform-commonjs' // theme-preval is commonjs and needs to be transformed to esm
]),
...sharedPlugins,
replacementPlugin('development')
]
Expand Down
26 changes: 24 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"babel-plugin-open-source": "1.3.2",
"babel-plugin-preval": "5.0.0",
"babel-plugin-styled-components": "2.0.2",
"babel-plugin-transform-commonjs": "1.1.6",
"babel-plugin-transform-replace-expressions": "0.2.0",
"babel-polyfill": "6.26.0",
"chroma-js": "2.1.2",
Expand Down
Loading

0 comments on commit 63a2de5

Please sign in to comment.