replace long rollup cli with rollup.config.js

This commit is contained in:
Adrian Leonhard
2020-05-24 12:18:32 +02:00
parent 394a4ae1e9
commit 4c625d6b21
2 changed files with 26 additions and 2 deletions

View File

@@ -3,14 +3,14 @@
"version": "5.6.0",
"description": "Utility functions and common patterns for MobX",
"main": "mobx-utils.umd.js",
"module": "lib/mobx-utils.js",
"module": "mobx-utils.module.js",
"jsnext:main": "mobx-utils.module.js",
"react-native": "mobx-utils.module.js",
"typings": "lib/mobx-utils.d.ts",
"sideEffects": false,
"scripts": {
"prettier": "prettier --write \"**/*.js\" \"**/*.jsx\" \"**/*.tsx\" \"**/*.ts\"",
"build": "tsc -p src && rollup lib/mobx-utils.js -e mobx -g mobx:mobx -o mobx-utils.umd.js -f umd --name mobxUtils && rollup lib/mobx-utils.js -e mobx -o mobx-utils.module.js -f es",
"build": "tsc -p src && rollup -c",
"watch": "jest --watch",
"test": "jest",
"prepublishOnly": "npm run build && npm run build-docs",

24
rollup.config.js Normal file
View File

@@ -0,0 +1,24 @@
export default {
input: "lib/mobx-utils.js",
output: [
{
format: "umd",
file: "mobx-utils.umd.js",
name: "mobxUtils",
globals: {
mobx: "mobx",
},
},
{
format: "es",
file: "mobx-utils.module.js",
},
],
external: ["mobx"],
onwarn: function (warning, warn) {
// https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
if ("THIS_IS_UNDEFINED" === warning.code) return
warn(warning)
},
}