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/);