Skip to content

Commit af0289c

Browse files
authored
fix: set minify to false (#117)
* fix: allow minify for expo projects only * fix: added default false value to isExpo * docs: add expo args information
1 parent 28fdc61 commit af0289c

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ All command-line arguments are optional. By default a production build will be c
4848
| `only-mapped` | Exclude "unmapped" bytes from the output (default is **false**). This will result in total counts less than the file size. | `--only-mapped` |
4949
| `verbose` | Dumps additional output to the console (default is **false**) | `--verbose` |
5050
| `reset-cache` | Removes cached react-native files (default is **false**) | `--reset-cache` |
51+
| `--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` |
5152

5253
[smeo]: https://github.com/danvk/source-map-explorer#options
5354

54-
> 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.
55+
>Use [react-native-bundle-visualizer@2](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) when targetting Expo SDK 40 or lower.
5556
5657
## Version compatibility
5758

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
"scripts": {
3232
"test": "yarn test:rn && yarn test:expo",
3333
"test:rn": "cd test/RN64 && yarn install && npx ../.. && cd ../..",
34-
"test:expo": "cd test/Expo42 && yarn install && npx ../.. && cd ../.."
34+
"test:expo": "cd test/Expo42 && yarn install && npx ../.. --expo=true && cd ../.."
3535
}
3636
}

src/react-native-bundle-visualizer.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const tmpDir = path.join(baseDir, getAppName());
5959
const outDir = path.join(tmpDir, 'output');
6060
const entryFile = argv['entry-file'] || getEntryPoint();
6161
const platform = argv.platform || 'ios';
62-
const expoTargetDeprecated = argv.expo || '';
62+
const isExpo = argv.expo || false;
6363
const dev = argv.dev || false;
6464
const verbose = argv.verbose || false;
6565
const resetCache = argv['reset-cache'] || false;
@@ -95,21 +95,14 @@ const commands = [
9595
bundleOutput,
9696
'--sourcemap-output',
9797
bundleOutputSourceMap,
98+
'--minify',
99+
isExpo
98100
];
99101
if (resetCache) {
100102
commands.push('--reset-cache');
101103
commands.push(resetCache);
102104
}
103105

104-
// Warn about `--expo` deprecation
105-
if (expoTargetDeprecated) {
106-
console.error(
107-
chalk.red.bold(
108-
'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`.'
109-
)
110-
);
111-
}
112-
113106
const reactNativeBin = getReactNativeBin();
114107
const bundlePromise = execa(reactNativeBin, commands);
115108
bundlePromise.stdout.pipe(process.stdout);
@@ -188,4 +181,7 @@ bundlePromise
188181

189182
// Open output file
190183
return open(bundleOutputExplorerFile);
191-
});
184+
}).catch(error => console.log(
185+
chalk.red('=== error ==='),
186+
error
187+
));

0 commit comments

Comments
 (0)