Enable build minification
Summary: This shaves another ~6MB of the zipped build. Less than I would have thought, but I haven't looked at the alternative options so far at all. Reviewed By: nikoant Differential Revision: D21131772 fbshipit-source-id: 641515d6f36fdeeffa5be81d64c2c1043a9e4e34
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2cf9eeb224
commit
9c18a98f89
@@ -54,6 +54,16 @@ export async function generatePluginEntryPoints() {
|
||||
console.log('✅ Generated plugin entry points.');
|
||||
}
|
||||
|
||||
const minifierConfig = {
|
||||
minifierPath: 'metro-minify-terser',
|
||||
minifierConfig: {
|
||||
// see: https://www.npmjs.com/package/terser
|
||||
keep_fnames: true,
|
||||
module: true,
|
||||
warnings: true,
|
||||
},
|
||||
};
|
||||
|
||||
async function compile(
|
||||
buildFolder: string,
|
||||
projectRoot: string,
|
||||
@@ -71,6 +81,7 @@ async function compile(
|
||||
babelTransformationsDir,
|
||||
'transform-app',
|
||||
),
|
||||
...minifierConfig,
|
||||
},
|
||||
resolver: {
|
||||
resolverMainFields: ['flipperBundlerEntry', 'module', 'main'],
|
||||
@@ -80,7 +91,7 @@ async function compile(
|
||||
},
|
||||
{
|
||||
dev,
|
||||
minify: false,
|
||||
minify: !dev,
|
||||
resetCache: !dev,
|
||||
sourceMap: true,
|
||||
entry,
|
||||
@@ -145,6 +156,7 @@ export async function compileMain() {
|
||||
babelTransformationsDir,
|
||||
'transform-main',
|
||||
),
|
||||
...minifierConfig,
|
||||
},
|
||||
resolver: {
|
||||
sourceExts: ['tsx', 'ts', 'js'],
|
||||
@@ -157,7 +169,7 @@ export async function compileMain() {
|
||||
entry: path.join(staticDir, 'main.ts'),
|
||||
out,
|
||||
dev,
|
||||
minify: false,
|
||||
minify: !dev,
|
||||
sourceMap: true,
|
||||
resetCache: !dev,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user