@lark-apaas/fullstack-rspack-preset 1.0.50 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -32,11 +32,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
const core_1 = __importDefault(require("@rspack/core"));
|
|
40
36
|
const fs = __importStar(require("fs"));
|
|
41
37
|
const path = __importStar(require("path"));
|
|
42
38
|
class SourceMapUploadPlugin {
|
|
@@ -51,7 +47,7 @@ class SourceMapUploadPlugin {
|
|
|
51
47
|
console.log('SourceMapUploadPlugin: Starting sourcemap consolidation process...');
|
|
52
48
|
const outputPath = compiler.options.output.path;
|
|
53
49
|
if (!outputPath) {
|
|
54
|
-
|
|
50
|
+
console.warn('SourceMapUploadPlugin: compiler.options.output.path is not defined. Skipping sourcemap consolidation.');
|
|
55
51
|
return;
|
|
56
52
|
}
|
|
57
53
|
const assets = compilation.getAssets();
|
|
@@ -63,12 +59,7 @@ class SourceMapUploadPlugin {
|
|
|
63
59
|
const outputBaseDir = path.basename(outputPath); // e.g., 'client'
|
|
64
60
|
const sourcemapTargetDir = path.join(this.options.outputDir, outputBaseDir); // e.g., 'dist/sourcemaps/client'
|
|
65
61
|
for (const sourceMap of sourceMaps) {
|
|
66
|
-
|
|
67
|
-
// Align with Vite's output structure by adding 'assets' and removing 'chunks'
|
|
68
|
-
if (assetName.startsWith('chunks/')) {
|
|
69
|
-
assetName = assetName.substring('chunks/'.length);
|
|
70
|
-
}
|
|
71
|
-
assetName = path.join('assets', assetName);
|
|
62
|
+
const assetName = path.join('assets', path.basename(sourceMap.name));
|
|
72
63
|
const destinationPath = path.join(sourcemapTargetDir, assetName);
|
|
73
64
|
const originalPath = path.join(outputPath, sourceMap.name);
|
|
74
65
|
try {
|
|
@@ -88,19 +79,12 @@ class SourceMapUploadPlugin {
|
|
|
88
79
|
console.log(`SourceMapUploadPlugin: Deleted original sourcemap ${originalPath}`);
|
|
89
80
|
}
|
|
90
81
|
catch (deleteError) {
|
|
91
|
-
|
|
92
|
-
compilation.warnings.push(new core_1.default.WebpackError(`${deleteErrorMessage} Error: ${String(deleteError)}`));
|
|
82
|
+
console.warn(`SourceMapUploadPlugin: Failed to delete original sourcemap ${originalPath}.`, deleteError);
|
|
93
83
|
}
|
|
94
84
|
}
|
|
95
85
|
catch (error) {
|
|
96
86
|
const errorMessage = `SourceMapUploadPlugin: Failed to consolidate ${assetName}.`;
|
|
97
87
|
console.error(errorMessage, error);
|
|
98
|
-
if (error instanceof Error) {
|
|
99
|
-
compilation.errors.push(new Error(`${errorMessage} Error: ${error.message}`));
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
compilation.errors.push(new Error(`${errorMessage} Error: ${String(error)}`));
|
|
103
|
-
}
|
|
104
88
|
}
|
|
105
89
|
}
|
|
106
90
|
});
|