Skip to content

Commit 7d7721c

Browse files
committed
Added es build, which will get beneficial for es2015 modules aware bundlers like webpack 2+ and rollup
1 parent 1437e67 commit 7d7721c

File tree

5 files changed

+642
-595
lines changed

5 files changed

+642
-595
lines changed

.babelrc

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
{
22
"presets": [
3-
["latest", {
4-
"es2015": { "loose": true }
5-
}],
6-
"stage-2",
7-
"react"
8-
],
9-
"plugins": [
10-
"dev-expression",
11-
"add-module-exports",
12-
"transform-object-assign",
13-
["transform-react-remove-prop-types", { "mode": "wrap" }]
3+
"./.babelrc.js"
144
]
155
}

.babelrc.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const modules = process.env.BABEL_ENV === 'es' ? false : 'commonjs'
2+
3+
const presets = [
4+
['latest', {
5+
es2015: { loose: true, modules }
6+
}],
7+
'stage-2',
8+
'react'
9+
]
10+
11+
const plugins = [
12+
'dev-expression',
13+
'add-module-exports',
14+
'transform-object-assign',
15+
['transform-react-remove-prop-types', { mode: 'wrap' }]
16+
]
17+
18+
module.exports = { plugins, presets }

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
"version": "2.3.0-beta.0",
44
"description": "A react component toolset for managing animations",
55
"main": "lib/index.js",
6+
"module": "es/index.js",
67
"scripts": {
78
"test": "npm run lint && npm run testonly",
89
"testonly": "jest --verbose",
910
"tdd": "jest --watch",
10-
"build": "rimraf lib && babel src --out-dir lib && npm run build:dist && cp README.md LICENSE ./lib",
11+
"build": "rimraf lib && npm run build:cjs && npm run build:es && npm run build:dist && cp README.md LICENSE ./lib",
12+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir lib/es",
13+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir lib",
1114
"build:dist": "rimraf lib/dist && webpack && NODE_ENV=production webpack -p",
1215
"lint": "eslint src test",
1316
"release": "release",
@@ -71,6 +74,7 @@
7174
"babel-preset-latest": "^6.24.0",
7275
"babel-preset-react": "^6.23.0",
7376
"babel-preset-stage-2": "^6.18.0",
77+
"cross-env": "^5.0.1",
7478
"enzyme": "^3.0.0",
7579
"enzyme-adapter-react-16": "^1.0.0",
7680
"eslint": "^3.17.1",

src/index.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import CSSTransition from './CSSTransition';
2-
import ReplaceTransition from './ReplaceTransition';
3-
import TransitionGroup from './TransitionGroup';
4-
import Transition from './Transition';
5-
6-
7-
module.exports = {
8-
Transition,
9-
TransitionGroup,
10-
ReplaceTransition,
11-
CSSTransition,
12-
};
1+
export { default as CSSTransition } from './CSSTransition';
2+
export { default as ReplaceTransition } from './ReplaceTransition';
3+
export { default as TransitionGroup } from './TransitionGroup';
4+
export { default as Transition } from './Transition';

0 commit comments

Comments
 (0)