-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #200 from hypothesis/dual-build-esm-and-cjs
Dual-build package as ES modules and CommonJS
- Loading branch information
Showing
11 changed files
with
71 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const baseConfig = require('./.babelrc'); | ||
|
||
// Override base config to produce CommonJS instead of ESM output. | ||
const config = { ...baseConfig }; | ||
const presetEnvConfig = config.presets.find( | ||
([name]) => name === '@babel/preset-env' | ||
)[1]; | ||
presetEnvConfig.modules = 'cjs'; | ||
|
||
module.exports = config; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
runtime: 'automatic', | ||
importSource: 'preact', | ||
}, | ||
], | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
bugfixes: true, | ||
modules: false, // Produce ES module output | ||
}, | ||
], | ||
], | ||
env: { | ||
development: { | ||
presets: [ | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
development: true, | ||
runtime: 'automatic', | ||
// Use `preact/compat/jsx-dev-runtime` which is an alias for `preact/jsx-runtime`. | ||
// See https://github.com/preactjs/preact/issues/2974. | ||
importSource: 'preact/compat', | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
lib/** | ||
build/** | ||
lib-cjs/** | ||
build/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules/ | ||
lib/ | ||
lib-cjs/ | ||
build/ | ||
coverage/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.*/** | ||
build/ | ||
lib/ | ||
lib-cjs/ | ||
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters