Skip to content

Commit

Permalink
feat: add ESM build (jquense#738)
Browse files Browse the repository at this point in the history
* Build CommonJS and ESM versions on build

* Use --env-name instead of BABEL_ENV
  • Loading branch information
sheepsteak authored and jquense committed Jan 10, 2020
1 parent 38841c8 commit 7036522
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
{
"presets": [["jason", { "debug": true, "ignoreBrowserslistConfig": true }]],
"env": {
"modules": {
"presets": [
[
"jason",
{ "debug": true, "ignoreBrowserslistConfig": true, "modules": false }
]
]
},
"test": {
"sourceMaps": "inline",
"presets": [
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ $RECYCLE.BIN/

# Ignore build files
lib/
es/
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.28.0",
"description": "Dead simple Object schema validation",
"main": "lib/index.js",
"module": "es/index.js",
"runkitExampleFilename": "./runkit-example.js",
"scripts": {
"test": "npm run lint && npm run test-all -- --runInBand",
Expand All @@ -13,10 +14,13 @@
"precommit": "lint-staged",
"toc": "doctoc README.md --github",
"release": "rollout",
"build": "babel src --out-dir lib --delete-dir-on-start && npm run toc",
"build": "yarn build:commonjs && yarn build:modules && npm run toc",
"build:commonjs": "babel src --out-dir lib --delete-dir-on-start",
"build:modules": "babel src --out-dir es --delete-dir-on-start --env-name modules",
"prepublishOnly": "npm run build"
},
"files": [
"es",
"lib"
],
"repository": {
Expand Down

0 comments on commit 7036522

Please sign in to comment.