Skip to content

Commit

Permalink
Merge pull request #223 from brigade/make-mjs-opt-in
Browse files Browse the repository at this point in the history
Make ES module opt-in
  • Loading branch information
trotzig authored Oct 5, 2017
2 parents 08e2d7c + c593bdf commit 983f81d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build
es
cjs
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build
es
cjs
node_modules
npm-debug.log
.idea/
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@ yarn add react-waypoint
## Usage

```jsx
var Waypoint = require('react-waypoint');
```
import Waypoint from 'react-waypoint';

```jsx
<Waypoint
onEnter={this._handleWaypointEnter}
onLeave={this._handleWaypointLeave}
/>
```

*Alternatively, you can also use the ES module that this package provides:
`import Waypoint from 'react-waypoint/es'`.*

A waypoint normally fires `onEnter` and `onLeave` as you are scrolling, but it
can fire because of other events too:

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"name": "react-waypoint",
"version": "7.3.0",
"description": "A React component to execute a function whenever you scroll to an element.",
"main": "build/index.js",
"module": "build/index.mjs",
"main": "cjs/index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
Expand All @@ -15,7 +14,7 @@
"build": "npm run clean && rollup -c",
"check-changelog": "expr $(git status --porcelain 2>/dev/null| grep \"^\\s*M.*CHANGELOG.md\" | wc -l) >/dev/null || (echo 'Please edit CHANGELOG.md' && exit 1)",
"check-only-changelog-changed": "(expr $(git status --porcelain 2>/dev/null| grep -v \"CHANGELOG.md\" | wc -l) >/dev/null && echo 'Only CHANGELOG.md may have uncommitted changes' && exit 1) || exit 0",
"clean": "rimraf build",
"clean": "rimraf es cjs",
"lint": "eslint . --ext .js,.jsx",
"postversion": "git commit package.json CHANGELOG.md -m \"Version $npm_package_version\" && npm run tag && git push && git push --tags && npm publish",
"prepublish": "in-publish && safe-publish-latest && npm run build || not-in-publish",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default [
],
output: [
{ file: pkg.main, format: 'cjs' },
{ file: pkg.module, format: 'es' }
{ file: 'es/index.mjs', format: 'es' }
],
plugins: [
babel({
Expand Down

0 comments on commit 983f81d

Please sign in to comment.