Skip to content

Commit 981ca45

Browse files
committed
Add es modules entry point
1 parent 24d924f commit 981ca45

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

.babelrc-esm

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"esmodules": true
9+
}
10+
}
11+
],
12+
"@babel/preset-react"
13+
],
14+
"plugins": [
15+
"@babel/plugin-proposal-object-rest-spread",
16+
"@babel/plugin-proposal-class-properties"
17+
]
18+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
node_modules
22
coverage
33
lib
4+
esm
45
npm-debug.log.*
56
.DS_Store

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
"version": "0.7.1",
44
"description": "Intro.js React Wrapper",
55
"main": "lib/index.js",
6+
"module": "esm/index.js",
67
"types": "index.d.ts",
78
"scripts": {
8-
"prebuild": "rimraf lib/*",
9+
"prebuild": "rimraf lib/* && rimraf esm/*",
910
"build": "babel --ignore '**/*.test.js' --out-dir lib src",
11+
"build:esm": "babel --ignore '**/*.test.js' --out-dir esm --config-file ./.babelrc-esm --no-babelrc src",
1012
"build:watch": "npm run build -- --watch",
1113
"lint": "eslint src",
1214
"test": "jest",
1315
"test:watch": "jest --watch",
1416
"test:coverage": "jest --coverage && open coverage/index.html",
1517
"test:ci": "jest --coverage",
1618
"precommit": "lint-staged",
17-
"prepublish": "npm run build"
19+
"prepublish": "npm run build && npm run build:esm"
1820
},
1921
"devDependencies": {
2022
"@babel/cli": "7.8.4",
@@ -80,6 +82,7 @@
8082
},
8183
"files": [
8284
"lib",
85+
"esm",
8386
"src",
8487
"index.d.ts"
8588
]

0 commit comments

Comments
 (0)