-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use rollup to create an UMD module build
Closes #1
- Loading branch information
1 parent
144c71c
commit 546de6e
Showing
4 changed files
with
214 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules/ | ||
.source.* | ||
.nyc_output/ | ||
dist/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,36 @@ | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
|
||
const pkg = require('./package') | ||
|
||
const banner = (_ => { | ||
const id = `${pkg.name} v${pkg.version}` | ||
const homepage = 'github.com/' + pkg.repository | ||
const license = `${pkg.license} License` | ||
return `/*! ${id} | ${homepage} | ${license} */` | ||
})() | ||
|
||
function outputConfig(config) { | ||
const defaultConfig = { | ||
sourcemap: true, | ||
banner, | ||
} | ||
return Object.assign(defaultConfig, config) | ||
} | ||
|
||
export default { | ||
input: 'dexie-batch.js', | ||
output: [ | ||
// Browser-friendly UMD build | ||
outputConfig({ | ||
file: pkg.main, | ||
name: 'DexieBatch', | ||
format: 'umd', | ||
globals: { dexie: 'Dexie' }, | ||
}), | ||
// ECMAScript module build | ||
outputConfig({ file: pkg.module, format: 'es' }), | ||
], | ||
external: ['dexie'], | ||
plugins: [resolve(), commonjs()], | ||
} |