Skip to content

Commit

Permalink
Make separate bundles for CommonJS/module
Browse files Browse the repository at this point in the history
  • Loading branch information
pablosichert committed Mar 6, 2017
1 parent b604138 commit 7098a12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 13 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
{
"presets": [
"es2015",
["es2015", { "modules": false }],
"react"
],
"plugins": [
"add-module-exports",
"syntax-async-functions",
"transform-class-properties",
"transform-object-rest-spread",
"transform-regenerator"
]
],
"env": {
"CommonJS": {
"presets": [
"es2015"
],
// For some reason this duplicate is needed
"plugins": [
"transform-class-properties"
]
}
}
}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"src"
],
"scripts": {
"compile": "babel ./src --out-dir ./lib",
"compile": "mkdir lib; babel ./src --out-file ./lib/Truncate.js && BABEL_ENV=CommonJS babel ./src --out-file ./lib/Truncate.CommonJS.js",
"coverage": "nyc npm test && nyc report --reporter=text-lcov",
"lint": "eslint .",
"prepublish": "rm -rf ./lib && npm run compile",
Expand Down Expand Up @@ -37,7 +37,6 @@
"devDependencies": {
"babel-cli": "^6.23.0",
"babel-eslint": "^7.1.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-transform-async-to-generator": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.23.0",
Expand Down

0 comments on commit 7098a12

Please sign in to comment.