Skip to content

Commit

Permalink
fix: set minify to false (#117)
Browse files Browse the repository at this point in the history
* fix: allow minify for expo projects only

* fix: added default false value to isExpo

* docs: add expo args information
  • Loading branch information
hurali97 authored Feb 13, 2023
1 parent 28fdc61 commit af0289c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../.."
}
}
18 changes: 7 additions & 11 deletions src/react-native-bundle-visualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -188,4 +181,7 @@ bundlePromise

// Open output file
return open(bundleOutputExplorerFile);
});
}).catch(error => console.log(
chalk.red('=== error ==='),
error
));

0 comments on commit af0289c

Please sign in to comment.