ptech-preset 1.3.7 → 1.3.9

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -435,9 +435,8 @@ function pluginCore(opts) {
435
435
  const target = JSON.stringify(targetImport);
436
436
  lines.push(`export * from ${target};`);
437
437
  lines.push(`export { default } from ${target};`);
438
- lines.push(
439
- `if (import.meta && (import.meta as any).webpackHot) {(import.meta as any).webpackHot.accept();}`
440
- );
438
+ lines.push(`;(import.meta as any).webpackHot?.accept?.();`);
439
+ lines.push(`;(import.meta as any).hot?.accept?.();`);
441
440
  lines.push(`// generated by plugin-mf-auto`);
442
441
  fs3.writeFileSync(proxyFile, lines.join(os.EOL), "utf8");
443
442
  const relFromRoot = path3.relative(root, proxyFile).replace(/\\/g, "/");
@@ -452,7 +451,8 @@ function pluginCore(opts) {
452
451
  fs3.writeFileSync(
453
452
  stylesFile,
454
453
  `import ${JSON.stringify(cssImport)};
455
- if (import.meta && (import.meta as any).webpackHot) {(import.meta as any).webpackHot.accept();}
454
+ ;(import.meta as any).webpackHot?.accept?.();
455
+ ;(import.meta as any).hot?.accept?.();
456
456
  // generated by plugin-mf-auto`,
457
457
  "utf8"
458
458
  );
@@ -519,12 +519,13 @@ if (import.meta && (import.meta as any).webpackHot) {(import.meta as any).webpac
519
519
  const pkgSafe = getPackageName(root) || mfMerged.name || path3.basename(root).replace(/\W+/g, "");
520
520
  api.modifyRsbuildConfig((config) => {
521
521
  config.output ??= {};
522
- const current = config.output.assetPrefix;
523
522
  const fromEnv = process.env.CDN_URL || process.env.ASSET_PREFIX;
524
523
  const fallbackCdn = `${CDN_BASE}${pkgSafe}/`;
525
524
  const target = fromEnv ?? fallbackCdn;
526
- if (isBuild && (!current || current === "/" || current === "./")) {
525
+ if (isBuild) {
527
526
  config.output.assetPrefix = target;
527
+ } else {
528
+ config.output.assetPrefix = "/";
528
529
  }
529
530
  return config;
530
531
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ptech-preset",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "Auto Module.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",