Skip to content

Commit

Permalink
Add esmodule support
Browse files Browse the repository at this point in the history
  • Loading branch information
dpikt committed Jun 24, 2019
1 parent 360e735 commit 1bf1bdb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lib
esm
/log/*
/tmp/*
!/log/.keep
Expand Down
10 changes: 10 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
"presets": [
["@launchpadlab/babel-preset/react", {
"env": {
// Don't transform modules in "esm" mode.
"modules": process.env.BABEL_ENV === 'esm' ? false : 'auto'
}
}]
]
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
},
"description": "Our Components",
"main": "lib/index.js",
"module": "esm/index.js",
"sideEffects": false,
"repository": "launchpadlab/lp-components",
"homepage": "https://github.com/launchpadlab/lp-components",
"author": {
Expand All @@ -15,8 +17,10 @@
"license": "MIT",
"scripts": {
"start": "yarn run build:development",
"build": "babel src --out-dir lib",
"build:development": "babel src --watch --out-dir lib",
"build": "yarn build:cjs && yarn build:esm",
"build:cjs": "babel src --out-dir lib",
"build:esm": "BABEL_ENV=esm babel src --out-dir esm",
"build:development": "BABEL_ENV=esm babel src --watch --out-dir esm",
"clean": "rimraf lib",
"docs": "documentation build src/index.js -f md -o docs.md",
"lint": "eslint src",
Expand Down

0 comments on commit 1bf1bdb

Please sign in to comment.