Skip to content

Commit abef760

Browse files
bozaigaosunnylqm
andauthored
add logic to remove soucemap and merge sourcemap params (#9)
* add logic to remove soucemap and merge sourcemap params * Update bundle.js --------- Co-authored-by: Sunny Luo <sunnylqm@gmail.com>
1 parent 467ef0c commit abef760

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/bundle.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ async function runReactNativeBundleCommand(
8787
}
8888
}
8989
const bundleParams = await checkPlugins();
90-
const minifyOption = bundleParams.minify;
9190
const isSentry = bundleParams.sentry;
9291
const bundleCommand = usingExpo
9392
? 'export:embed'
@@ -126,8 +125,6 @@ async function runReactNativeBundleCommand(
126125
'--platform',
127126
platform,
128127
'--reset-cache',
129-
'--minify',
130-
minifyOption,
131128
]);
132129

133130
if (sourcemapOutput) {
@@ -420,7 +417,7 @@ async function pack(dir, output) {
420417
}
421418
const childs = fs.readdirSync(root);
422419
for (const name of childs) {
423-
if (name === '.' || name === '..' || name === 'index.bundlejs.map') {
420+
if (name === '.' || name === '..' || name === 'index.bundlejs.map' || name === 'index.bundlejs.txt.map') {
424421
continue;
425422
}
426423
const fullPath = path.join(root, name);
@@ -814,14 +811,14 @@ export const commands = {
814811
options.platform || (await question('平台(ios/android/harmony):')),
815812
);
816813

817-
const { bundleName, entryFile, intermediaDir, output, dev } =
814+
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
818815
translateOptions({
819816
...options,
820817
platform,
821818
});
822819

823820
const bundleParams = await checkPlugins();
824-
const sourcemap = bundleParams.sourcemap;
821+
const sourcemapPlugin = bundleParams.sourcemap;
825822
const isSentry = bundleParams.sentry;
826823

827824
const sourcemapOutput = path.join(intermediaDir, `${bundleName}.map`);
@@ -842,7 +839,7 @@ export const commands = {
842839
entryFile,
843840
intermediaDir,
844841
platform,
845-
sourcemap ? sourcemapOutput : '',
842+
sourcemap || sourcemapPlugin ? sourcemapOutput : '',
846843
);
847844

848845
await pack(path.resolve(intermediaDir), realOutput);

src/utils/check-plugin.ts

-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { plugins } from './plugin-config';
22

33
interface BundleParams {
44
sentry: boolean;
5-
minify: boolean;
65
sourcemap: boolean;
76
[key: string]: any;
87
}
98

109
export async function checkPlugins(): Promise<BundleParams> {
1110
const params: BundleParams = {
1211
sentry: false,
13-
minify: true,
1412
sourcemap: false,
1513
};
1614

src/utils/plugin-config.ts

-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import fs from 'fs-extra';
33
interface PluginConfig {
44
name: string;
55
bundleParams?: {
6-
minify?: boolean;
76
[key: string]: any;
87
};
98
detect: () => Promise<boolean>;
@@ -14,7 +13,6 @@ export const plugins: PluginConfig[] = [
1413
name: 'sentry',
1514
bundleParams: {
1615
sentry: true,
17-
minify: false,
1816
sourcemap: true,
1917
},
2018
detect: async () => {

0 commit comments

Comments
 (0)