Skip to content

Commit 7036522

Browse files
sheepsteakjquense
authored andcommittedJan 10, 2020
feat: add ESM build (#738)
* Build CommonJS and ESM versions on build * Use --env-name instead of BABEL_ENV
1 parent 38841c8 commit 7036522

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
 

‎.babelrc

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
{
22
"presets": [["jason", { "debug": true, "ignoreBrowserslistConfig": true }]],
33
"env": {
4+
"modules": {
5+
"presets": [
6+
[
7+
"jason",
8+
{ "debug": true, "ignoreBrowserslistConfig": true, "modules": false }
9+
]
10+
]
11+
},
412
"test": {
513
"sourceMaps": "inline",
614
"presets": [

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,4 @@ $RECYCLE.BIN/
7676

7777
# Ignore build files
7878
lib/
79+
es/

‎package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.28.0",
44
"description": "Dead simple Object schema validation",
55
"main": "lib/index.js",
6+
"module": "es/index.js",
67
"runkitExampleFilename": "./runkit-example.js",
78
"scripts": {
89
"test": "npm run lint && npm run test-all -- --runInBand",
@@ -13,10 +14,13 @@
1314
"precommit": "lint-staged",
1415
"toc": "doctoc README.md --github",
1516
"release": "rollout",
16-
"build": "babel src --out-dir lib --delete-dir-on-start && npm run toc",
17+
"build": "yarn build:commonjs && yarn build:modules && npm run toc",
18+
"build:commonjs": "babel src --out-dir lib --delete-dir-on-start",
19+
"build:modules": "babel src --out-dir es --delete-dir-on-start --env-name modules",
1720
"prepublishOnly": "npm run build"
1821
},
1922
"files": [
23+
"es",
2024
"lib"
2125
],
2226
"repository": {

0 commit comments

Comments
 (0)
Please sign in to comment.