Skip to content

Commit 441c383

Browse files
committed
add logic to remove soucemap and merge sourcemap params
1 parent 467ef0c commit 441c383

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/bundle.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ async function pack(dir, output) {
420420
}
421421
const childs = fs.readdirSync(root);
422422
for (const name of childs) {
423-
if (name === '.' || name === '..' || name === 'index.bundlejs.map') {
423+
if (name === '.' || name === '..' || name === 'index.bundlejs.map' || name === 'index.bundlejs.txt.map') {
424424
continue;
425425
}
426426
const fullPath = path.join(root, name);
@@ -814,14 +814,14 @@ export const commands = {
814814
options.platform || (await question('平台(ios/android/harmony):')),
815815
);
816816

817-
const { bundleName, entryFile, intermediaDir, output, dev } =
817+
const { bundleName, entryFile, intermediaDir, output, dev, sourcemap } =
818818
translateOptions({
819819
...options,
820820
platform,
821821
});
822822

823823
const bundleParams = await checkPlugins();
824-
const sourcemap = bundleParams.sourcemap;
824+
const sourcemapPlugin = bundleParams.sourcemap;
825825
const isSentry = bundleParams.sentry;
826826

827827
const sourcemapOutput = path.join(intermediaDir, `${bundleName}.map`);
@@ -842,7 +842,7 @@ export const commands = {
842842
entryFile,
843843
intermediaDir,
844844
platform,
845-
sourcemap ? sourcemapOutput : '',
845+
sourcemap || sourcemapPlugin ? sourcemapOutput : '',
846846
);
847847

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

src/utils/check-plugin.ts

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 2 deletions
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)