From 4c625d6b21fb50e0e4e4bd9a0cb1f282ba8a2f25 Mon Sep 17 00:00:00 2001 From: Adrian Leonhard Date: Sun, 24 May 2020 12:18:32 +0200 Subject: [PATCH] replace long rollup cli with rollup.config.js --- package.json | 4 ++-- rollup.config.js | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 rollup.config.js diff --git a/package.json b/package.json index b7a85cb..1431243 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..4f48e33 --- /dev/null +++ b/rollup.config.js @@ -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) + }, +}