ptech-preset 1.4.1 → 1.4.3
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/dist/index.js +6 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -405,6 +405,7 @@ function pluginCore(opts) {
|
|
|
405
405
|
mfMerged.shared = DEFAULT_SHARED;
|
|
406
406
|
}
|
|
407
407
|
const command = api?.context?.command;
|
|
408
|
+
console.log("command:", command);
|
|
408
409
|
const isBuild = command === "build";
|
|
409
410
|
const isDev = !isBuild;
|
|
410
411
|
if (cssInjection !== "none") {
|
|
@@ -519,15 +520,14 @@ function pluginCore(opts) {
|
|
|
519
520
|
const pkgSafe = getPackageName(root) || mfMerged.name || path3.basename(root).replace(/\W+/g, "");
|
|
520
521
|
api.modifyRsbuildConfig((config) => {
|
|
521
522
|
config.output ??= {};
|
|
522
|
-
const fromEnv = process.env.CDN_URL || process.env.ASSET_PREFIX;
|
|
523
|
-
console.log("fromEnv", fromEnv);
|
|
524
|
-
console.log("process.env.CDN_URL", process.env.CDN_URL);
|
|
525
|
-
console.log("process.env.ASSET_PREFIX", process.env.ASSET_PREFIX);
|
|
526
523
|
const fallbackCdn = `${CDN_BASE}${pkgSafe}/`;
|
|
527
|
-
const target = fromEnv ?? fallbackCdn;
|
|
528
524
|
if (isBuild) {
|
|
529
|
-
config.output.assetPrefix =
|
|
525
|
+
config.output.assetPrefix = fallbackCdn;
|
|
526
|
+
console.log("BUILD");
|
|
527
|
+
console.log("config.output.assetPrefix", config.output.assetPrefix);
|
|
530
528
|
} else {
|
|
529
|
+
console.log("DEV");
|
|
530
|
+
console.log("config.output.assetPrefix", config.output.assetPrefix);
|
|
531
531
|
config.output.assetPrefix = "/";
|
|
532
532
|
}
|
|
533
533
|
return config;
|