Skip to content

Commit

Permalink
Merge pull request #220 from brigade/rollup
Browse files Browse the repository at this point in the history
Build with rollup
  • Loading branch information
lencioni authored Oct 3, 2017
2 parents cff3f66 + f4296e7 commit 8a89c4d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
6 changes: 1 addition & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"plugins": [
"transform-react-jsx",
"add-module-exports"
],
"presets": ["es2015"]
"presets": [["airbnb", { "modules": false }]]
}
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "react-waypoint",
"version": "7.2.0",
"description": "A React component to execute a function whenever you scroll to an element.",
"main": "build/waypoint.js",
"main": "build/index.js",
"module": "build/index.mjs",
"types": "index.d.ts",
"repository": {
"type": "git",
Expand All @@ -11,7 +12,7 @@
"homepage": "https://github.com/brigade/react-waypoint",
"bugs": "https://github.com/brigade/react-waypoint/issues",
"scripts": {
"build": "npm run clean && babel src/ -d build/",
"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",
Expand All @@ -36,9 +37,7 @@
"babel-cli": "^6.23.0",
"babel-core": "^6.23.1",
"babel-loader": "^6.4.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-react-jsx": "^6.23.0",
"babel-preset-es2015": "^6.22.0",
"babel-preset-airbnb": "^2.4.0",
"eslint": "^3.17.1",
"eslint-config-brigade": "^3.2.1",
"eslint-plugin-react": "^6.10.0",
Expand All @@ -53,6 +52,8 @@
"react": "^16.0.0",
"react-dom": "^16.0.0",
"rimraf": "^2.6.1",
"rollup": "^0.50.0",
"rollup-plugin-babel": "^3.0.2",
"safe-publish-latest": "^1.1.1",
"webpack": "^2.3.3"
},
Expand Down
21 changes: 21 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import babel from 'rollup-plugin-babel';
import pkg from './package.json';

export default [
{
input: 'src/waypoint.jsx',
external: [
...Object.keys(pkg.dependencies),
...Object.keys(pkg.peerDependencies),
],
output: [
{ file: pkg.main, format: 'cjs' },
{ file: pkg.module, format: 'es' }
],
plugins: [
babel({
exclude: ['node_modules/**']
})
]
}
];

0 comments on commit 8a89c4d

Please sign in to comment.