Permalink
Browse files

packager: optimize assets' JS

Reviewed By: davidaurelio

Differential Revision: D5010186

fbshipit-source-id: 3c26d8b8792df1dbc24e5200f28f63e017cb0173
  • Loading branch information...
jeanlauliac authored and facebook-github-bot committed May 8, 2017
1 parent 2a5959a commit 7d6fec0a39a125404d31162546039104b004e1c5
@@ -0,0 +1,19 @@
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/
'use strict';
const UGLIFY_JS_OUTPUT_OPTIONS = {
ascii_only: true,
screw_ie8: true,
};
module.exports = {UGLIFY_JS_OUTPUT_OPTIONS};
@@ -13,15 +13,14 @@
const uglify = require('uglify-js');
const {UGLIFY_JS_OUTPUT_OPTIONS} = require('./JsMinification');
function minify(filename: string, code: string, sourceMap: ?string) {
const minifyResult = uglify.minify(code, {
fromString: true,
inSourceMap: sourceMap,
outSourceMap: true,
output: {
ascii_only: true,
screw_ie8: true,
},
output: UGLIFY_JS_OUTPUT_OPTIONS,
});
minifyResult.map = JSON.parse(minifyResult.map);
@@ -152,6 +152,7 @@ export type TransformedSourceFile =
export type LibraryOptions = {|
dependencies?: Array<string>,
optimize: boolean,
platform?: string,
rebasePath: string => string,
|};

0 comments on commit 7d6fec0

Please sign in to comment.