1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 01:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

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>
This commit is contained in:
波仔糕
2025-02-09 16:14:45 +08:00
committed by GitHub
parent 467ef0c60d
commit abef760f43
3 changed files with 4 additions and 11 deletions

View File

@@ -87,7 +87,6 @@ async function runReactNativeBundleCommand(
}
}
const bundleParams = await checkPlugins();
const minifyOption = bundleParams.minify;
const isSentry = bundleParams.sentry;
const bundleCommand = usingExpo
? 'export:embed'
@@ -126,8 +125,6 @@ async function runReactNativeBundleCommand(
'--platform',
platform,
'--reset-cache',
'--minify',
minifyOption,
]);
if (sourcemapOutput) {
@@ -420,7 +417,7 @@ async function pack(dir, output) {
}
const childs = fs.readdirSync(root);
for (const name of childs) {
if (name === '.' || name === '..' || name === 'index.bundlejs.map') {
if (name === '.' || name === '..' || name === 'index.bundlejs.map' || name === 'index.bundlejs.txt.map') {
continue;
}
const fullPath = path.join(root, name);
@@ -814,14 +811,14 @@ export const commands = {
options.platform || (await question('平台(ios/android/harmony):')),
);
const { bundleName, entryFile, intermediaDir, output, dev } =
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
translateOptions({
...options,
platform,
});
const bundleParams = await checkPlugins();
const sourcemap = bundleParams.sourcemap;
const sourcemapPlugin = bundleParams.sourcemap;
const isSentry = bundleParams.sentry;
const sourcemapOutput = path.join(intermediaDir, `${bundleName}.map`);
@@ -842,7 +839,7 @@ export const commands = {
entryFile,
intermediaDir,
platform,
sourcemap ? sourcemapOutput : '',
sourcemap || sourcemapPlugin ? sourcemapOutput : '',
);
await pack(path.resolve(intermediaDir), realOutput);

View File

@@ -2,7 +2,6 @@ import { plugins } from './plugin-config';
interface BundleParams {
sentry: boolean;
minify: boolean;
sourcemap: boolean;
[key: string]: any;
}
@@ -10,7 +9,6 @@ interface BundleParams {
export async function checkPlugins(): Promise<BundleParams> {
const params: BundleParams = {
sentry: false,
minify: true,
sourcemap: false,
};

View File

@@ -3,7 +3,6 @@ import fs from 'fs-extra';
interface PluginConfig {
name: string;
bundleParams?: {
minify?: boolean;
[key: string]: any;
};
detect: () => Promise<boolean>;
@@ -14,7 +13,6 @@ export const plugins: PluginConfig[] = [
name: 'sentry',
bundleParams: {
sentry: true,
minify: false,
sourcemap: true,
},
detect: async () => {