Skip to content

Commit 22b3a2d

Browse files
committed
fix: add verbose and minify options to align with reat-native command
1 parent 5786dc1 commit 22b3a2d

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/bundle/bundle.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ const bundleReactNative = async (config: BundlerConfig, shouldBuildSourceMaps?:
6666
platform: os,
6767
sourcemapOutput,
6868
extraBundlerOptions,
69+
verbose: useHermes,
70+
minify: !useHermes,
6971
})
7072

7173
if (shouldBuildSourceMaps && useHermes) {
72-
await runHermesEmitBinaryCommand(bundleName, outputDir, sourcemapOutput, extraHermesFlags)
74+
await runHermesEmitBinaryCommand(bundleName, outputDir, sourcemapOutput, [
75+
'-max-diagnostic-width=80',
76+
...extraHermesFlags,
77+
])
7378
}
7479

7580
return {

src/bundle/metroBundle.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { info } from './utils'
2+
13
const path = require('path')
24
const { spawnSync } = require('child_process')
35

@@ -14,6 +16,8 @@ interface MetroBundleOptions {
1416
sourcemapOutput?: string
1517
bundleCommand?: string
1618
extraBundlerOptions?: string[]
19+
verbose?: boolean
20+
minify?: boolean
1721
}
1822

1923
export const metroBundle = ({
@@ -28,6 +32,8 @@ export const metroBundle = ({
2832
assetsDest = outputDir,
2933
sourcemapOutputDir = '',
3034
sourcemapOutput = sourcemapOutputDir ? path.join(sourcemapOutputDir, `${bundleName}.map`) : null,
35+
verbose = false,
36+
minify = false,
3137
extraBundlerOptions = [],
3238
}: MetroBundleOptions) => {
3339
const args = [
@@ -38,10 +44,14 @@ export const metroBundle = ({
3844
`--bundle-output=${bundleOutput}`,
3945
sourcemapOutput && `--sourcemap-output=${sourcemapOutput}`,
4046
assetsDest && `--assets-dest=${assetsDest}`,
41-
resetCache && '--reset-cache',
47+
`--minify=${minify}`,
48+
resetCache && `--reset-cache`,
49+
verbose && `--verbose`,
4250
...extraBundlerOptions,
4351
].filter(Boolean)
4452

53+
info(`Running: ${getCliPath()} ${args.join(' ')}`)
54+
4555
spawnSync(getCliPath(), args, { stdio: 'inherit' })
4656
}
4757

0 commit comments

Comments
 (0)