From 21592d0198b9bd21128b6c8311496bbd9bb7da2e Mon Sep 17 00:00:00 2001 From: Jiachi Liu Date: Mon, 4 Mar 2024 00:41:41 +0100 Subject: [PATCH] Fix: preserving directives in minification --- src/build-config.ts | 4 +++- .../__snapshot__/ts-target-es2018.min.js.snapshot | 2 +- .../use-client/__snapshot__/use-client.min.js.snapshot | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/build-config.ts b/src/build-config.ts index 72ff258b..f1c6e0b6 100644 --- a/src/build-config.ts +++ b/src/build-config.ts @@ -47,7 +47,9 @@ import { } from './entries' const swcMinifyOptions = { - compress: true, + compress: { + directives: false, + }, format: { comments: 'some', }, diff --git a/test/compile/ts-target-es2018/__snapshot__/ts-target-es2018.min.js.snapshot b/test/compile/ts-target-es2018/__snapshot__/ts-target-es2018.min.js.snapshot index 5c1ab655..665098ce 100644 --- a/test/compile/ts-target-es2018/__snapshot__/ts-target-es2018.min.js.snapshot +++ b/test/compile/ts-target-es2018/__snapshot__/ts-target-es2018.min.js.snapshot @@ -1 +1 @@ -async function n(){await new Promise(n=>n(2))}let a={x:1,y:2};export{n as asyncFunc,a as spread}; +"use client";async function e(){await new Promise(e=>e(2))}let n={x:1,y:2};export{e as asyncFunc,n as spread}; diff --git a/test/compile/use-client/__snapshot__/use-client.min.js.snapshot b/test/compile/use-client/__snapshot__/use-client.min.js.snapshot index 4e2e4cb0..397cba20 100644 --- a/test/compile/use-client/__snapshot__/use-client.min.js.snapshot +++ b/test/compile/use-client/__snapshot__/use-client.min.js.snapshot @@ -1 +1 @@ -"use strict";import{c as t}from"./client-client-BsqZWj2c.js";var e=()=>t();export{e as default}; +"use strict";import{c as t}from"./client-client-B-RDfYre.js";var e=()=>t();export{e as default};