diff --git a/README.md b/README.md index 0480730..992562d 100644 --- a/README.md +++ b/README.md @@ -48,10 +48,11 @@ All command-line arguments are optional. By default a production build will be c | `only-mapped` | Exclude "unmapped" bytes from the output (default is **false**). This will result in total counts less than the file size. | `--only-mapped` | | `verbose` | Dumps additional output to the console (default is **false**) | `--verbose` | | `reset-cache` | Removes cached react-native files (default is **false**) | `--reset-cache` | +| `--expo` | Set this to true/ false based on whether using expo or not. For eg, set `--expo true` when using expo. Not required to pass this for react-native cli. (default is **false**) | `--expo false` | [smeo]: https://github.com/danvk/source-map-explorer#options -> The `--expo` command is no longer needed for Expo SDK 41 or higher; and has been removed. Use [react-native-bundle-visualizer@2](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) when targetting Expo SDK 40 or lower. +>Use [react-native-bundle-visualizer@2](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) when targetting Expo SDK 40 or lower. ## Version compatibility diff --git a/package.json b/package.json index f06d392..f0e217d 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,6 @@ "scripts": { "test": "yarn test:rn && yarn test:expo", "test:rn": "cd test/RN64 && yarn install && npx ../.. && cd ../..", - "test:expo": "cd test/Expo42 && yarn install && npx ../.. && cd ../.." + "test:expo": "cd test/Expo42 && yarn install && npx ../.. --expo=true && cd ../.." } } diff --git a/src/react-native-bundle-visualizer.js b/src/react-native-bundle-visualizer.js index b68d053..1309bf6 100755 --- a/src/react-native-bundle-visualizer.js +++ b/src/react-native-bundle-visualizer.js @@ -59,7 +59,7 @@ const tmpDir = path.join(baseDir, getAppName()); const outDir = path.join(tmpDir, 'output'); const entryFile = argv['entry-file'] || getEntryPoint(); const platform = argv.platform || 'ios'; -const expoTargetDeprecated = argv.expo || ''; +const isExpo = argv.expo || false; const dev = argv.dev || false; const verbose = argv.verbose || false; const resetCache = argv['reset-cache'] || false; @@ -95,21 +95,14 @@ const commands = [ bundleOutput, '--sourcemap-output', bundleOutputSourceMap, + '--minify', + isExpo ]; if (resetCache) { commands.push('--reset-cache'); commands.push(resetCache); } -// Warn about `--expo` deprecation -if (expoTargetDeprecated) { - console.error( - chalk.red.bold( - 'The "--expo" command is no longer needed for Expo SDK 41 or higher. When using Expo SDK 40 or lower, please use `react-native-bundle-visualizer@2`.' - ) - ); -} - const reactNativeBin = getReactNativeBin(); const bundlePromise = execa(reactNativeBin, commands); bundlePromise.stdout.pipe(process.stdout); @@ -188,4 +181,7 @@ bundlePromise // Open output file return open(bundleOutputExplorerFile); - }); + }).catch(error => console.log( + chalk.red('=== error ==='), + error + ));