swico 3.0.0-beta.3 → 3.0.0-beta.4
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.
- package/package.json +1 -1
- package/src/command/build.js +9 -6
package/package.json
CHANGED
package/src/command/build.js
CHANGED
|
@@ -18,6 +18,7 @@ const main_config_1 = require("../main-config");
|
|
|
18
18
|
const utils_1 = require("../utils");
|
|
19
19
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
20
20
|
const core_1 = require("@rsbuild/core");
|
|
21
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
21
22
|
const isAnalyze = process.env.ANALYZE === 'true';
|
|
22
23
|
function default_1() {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -34,12 +35,7 @@ function default_1() {
|
|
|
34
35
|
templateType
|
|
35
36
|
});
|
|
36
37
|
const rsbuild = yield (0, core_1.createRsbuild)({ config: buildConfig });
|
|
37
|
-
|
|
38
|
-
if (isAnalyze) {
|
|
39
|
-
yield rsbuild.preview();
|
|
40
|
-
}
|
|
41
|
-
utils_1.toast.info('Building...');
|
|
42
|
-
const now = Date.now();
|
|
38
|
+
let now;
|
|
43
39
|
rsbuild.onAfterBuild(({ stats }) => {
|
|
44
40
|
if (stats.hasErrors()) {
|
|
45
41
|
const info = stats.toJson({ all: true });
|
|
@@ -53,5 +49,12 @@ function default_1() {
|
|
|
53
49
|
const duration = Date.now() - now;
|
|
54
50
|
utils_1.toast.success(`Build complete in ${(duration / 1000).toFixed(2)}s`);
|
|
55
51
|
});
|
|
52
|
+
utils_1.toast.info('Building...');
|
|
53
|
+
now = Date.now();
|
|
54
|
+
yield rsbuild.build();
|
|
55
|
+
if (isAnalyze) {
|
|
56
|
+
const { urls, port } = yield rsbuild.preview();
|
|
57
|
+
utils_1.toast.info(`Bundle analysis is running at:${chalk_1.default.hex('#29abe0')}${urls[0]}`);
|
|
58
|
+
}
|
|
56
59
|
});
|
|
57
60
|
}
|