From 24faf6674a8ec5864a6de1f8697bb34f0960bc4c Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Fri, 31 Aug 2018 01:07:49 +0300 Subject: [PATCH] Fix source map disabling --- index.js | 3 ++- test/test.js | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index f0ae44a..4acea7b 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,8 @@ function uglify(userOptions = {}) { } const options = Object.assign({}, userOptions, { - sourceMap: userOptions.sourcemap !== false + sourceMap: userOptions.sourcemap !== false, + sourcemap: undefined }); return { diff --git a/test/test.js b/test/test.js index 2753fcb..11e10ca 100644 --- a/test/test.js +++ b/test/test.js @@ -37,12 +37,21 @@ test("minify with sourcemaps", async () => { expect(result.map).toBeTruthy(); }); +test("allow to disable source maps", async () => { + const bundle = await rollup({ + input: "test/fixtures/sourcemap.js", + plugins: [uglify({ sourcemap: false })] + }); + await bundle.generate({ format: "cjs" }); +}); + test("does not allow to pass sourceMap", async () => { try { const bundle = await rollup({ input: "test/fixtures/sourcemap.js", plugins: [uglify({ sourceMap: false })] }); + await bundle.generate({ format: "cjs" }); expect(true).toBeFalsy(); } catch (error) { expect(error.toString()).toMatch(/sourceMap option is removed/);