From ffe599b8ba16a7276e51e941a17d0d10cbfafda2 Mon Sep 17 00:00:00 2001 From: Jonas Gierer Date: Fri, 16 Jun 2017 18:48:27 +0200 Subject: [PATCH] Make sourcemaps on `npm run watch` optional Sourcemaps can be enabled by either setting the `SOURCEMAP` environment variable to `true` (works for `npm run build` too) or running `npm run watch:sourcemap` --- package.json | 4 +++- rollup.config.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9f26a30..7a41ad7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "scripts": { "test": "xo && ava && npm run build", "build": "rollup -c", - "watch": "run-p --continue-on-error --silent \"build -- --watch --sourcemap\"", + "watch": "run-p --continue-on-error --silent \"build -- --watch\"", + "watch:sourcemap": "cross-env SOURCEMAP=true run-p \"watch\"", "release:amo": "cd extension && webext submit", "release:cws": "cd extension && webstore upload --auto-publish", "release": "run-s release:*" @@ -29,6 +30,7 @@ "ava": "*", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "chrome-webstore-upload-cli": "^1.0.0", + "cross-env": "^5.0.1", "npm-run-all": "^4.0.2", "rollup": "^0.43.0", "rollup-watch": "^4.0.0", diff --git a/rollup.config.js b/rollup.config.js index 93dbe33..f20748d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -14,5 +14,6 @@ export default [ }), commonJS() ], - format: 'iife' + format: 'iife', + sourceMap: process.env.SOURCEMAP || false }));