Skip to content

Commit

Permalink
Respect mangle: false & sourceMap: false in minifierConfig (fac…
Browse files Browse the repository at this point in the history
…ebook#749)

Summary:
Fixes facebook#301

Pull Request resolved: facebook#749

Reviewed By: motiz88

Differential Revision: D33398597

Pulled By: rh389

fbshipit-source-id: c6fff45e20df500977215bebe6707d0bb84e84d2
  • Loading branch information
mfbx9da4 authored and nevilm-lt committed Mar 14, 2022
1 parent 0ebc844 commit de1872e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 16 deletions.
21 changes: 13 additions & 8 deletions packages/metro-minify-terser/src/minifier.js
Expand Up @@ -33,15 +33,20 @@ function minify({code, map, reserved, config}: MinifierOptions): {
} {
const options = {
...config,
mangle: {
...config.mangle,
reserved,
},
mangle:
config.mangle === false
? false
: {
...config.mangle,
reserved,
},
sourceMap: map
? {
...config.sourceMap,
content: map,
}
? config.sourceMap === false
? false
: {
...config.sourceMap,
content: map,
}
: false,
};

Expand Down
22 changes: 14 additions & 8 deletions packages/metro-minify-uglify/src/minifier.js
Expand Up @@ -34,14 +34,20 @@ function minify({code, map, reserved, config}: MinifierOptions): {
} {
const options = {
...config,
mangle: {
...config.mangle,
reserved,
},
sourceMap: {
...config.sourceMap,
content: map,
},
mangle:
config.mangle === false
? false
: {
...config.mangle,
reserved,
},
sourceMap:
config.sourceMap === false
? false
: {
...config.sourceMap,
content: map,
},
};

/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
Expand Down

0 comments on commit de1872e

Please sign in to comment.