Skip to content

Commit

Permalink
Fix source map disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Aug 30, 2018
1 parent 55c4d6f commit 24faf66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -7,7 +7,8 @@ function uglify(userOptions = {}) {
}

const options = Object.assign({}, userOptions, {
sourceMap: userOptions.sourcemap !== false
sourceMap: userOptions.sourcemap !== false,
sourcemap: undefined
});

return {
Expand Down
9 changes: 9 additions & 0 deletions test/test.js
Expand Up @@ -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/);
Expand Down

0 comments on commit 24faf66

Please sign in to comment.