-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from souporserious/provide-bundles
Provide cjs, esm and umd bundles instead of transpiled files
- Loading branch information
Showing
7 changed files
with
271 additions
and
1,185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,7 @@ | |
# APP | ||
node_modules | ||
npm-debug.log | ||
/dist/ | ||
/lib/ | ||
/esm/ | ||
/dist | ||
/example/bundle.js | ||
|
||
# General Files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
lib | ||
esm | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"dist/index.cjs.js": { | ||
"bundled": 13110, | ||
"minified": 7976, | ||
"gzipped": 1867 | ||
}, | ||
"dist/index.esm.js": { | ||
"bundled": 12814, | ||
"minified": 7745, | ||
"gzipped": 1800, | ||
"treeshaked": 2886 | ||
}, | ||
"dist/index.umd.js": { | ||
"bundled": 46401, | ||
"minified": 14814, | ||
"gzipped": 4138 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve' | ||
import babel from 'rollup-plugin-babel' | ||
import { sizeSnapshot } from 'rollup-plugin-size-snapshot' | ||
|
||
const pkg = require('./package.json') | ||
|
||
const input = './src/index.js' | ||
|
||
const isExternal = id => !id.startsWith('.') && !id.startsWith('/') | ||
|
||
const getBabelOptions = ({ useESModules }) => ({ | ||
exclude: '**/node_modules/**', | ||
runtimeHelpers: true, | ||
plugins: [ | ||
[ | ||
'@babel/plugin-transform-runtime', | ||
{ polyfill: false, useBuiltIns: true, useESModules }, | ||
], | ||
], | ||
}) | ||
|
||
export default [ | ||
{ | ||
input, | ||
output: { | ||
file: 'dist/index.umd.js', | ||
format: 'umd', | ||
name: 'ReactMeasure', | ||
globals: { | ||
react: 'React', | ||
}, | ||
}, | ||
external: ['react'], | ||
plugins: [ | ||
nodeResolve(), | ||
babel(getBabelOptions({ useESModules: true })), | ||
sizeSnapshot(), | ||
], | ||
}, | ||
|
||
{ | ||
input, | ||
output: { file: pkg.main, format: 'cjs' }, | ||
external: isExternal, | ||
plugins: [babel(getBabelOptions({ useESModules: false })), sizeSnapshot()], | ||
}, | ||
|
||
{ | ||
input, | ||
output: { file: pkg.module, format: 'es' }, | ||
external: isExternal, | ||
plugins: [ | ||
babel(getBabelOptions({ useESModules: true })), | ||
sizeSnapshot({ treeshake: true }), | ||
], | ||
}, | ||
] |
Oops, something went wrong.