Skip to content

Commit

Permalink
Fixed in order to sovle the issue when tree shaking
Browse files Browse the repository at this point in the history
  • Loading branch information
genki committed Sep 19, 2023
1 parent 5d85187 commit 2a338d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/qwik/src/core/container/serializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ const MapSerializer: Serializer<Map<any, any>> = {

const StringSerializer: Serializer<string> = {
$prefix$: '\u001b',
$test$: (v) => typeof v === 'string' && prefixes.has(v[0]),
$test$: (v) => typeof v === 'string' && startsWithPrefix(v),
$serialize$: (v) => v,
$prepare$: (data) => data,
$fill$: undefined,
Expand Down Expand Up @@ -516,7 +516,11 @@ const serializers: Serializer<any>[] = [
DocumentSerializer, ///////// \u000F
];

const prefixes = new Set([UNDEFINED_PREFIX, ...serializers.map((a) => a.$prefix$)]);
const prefixes = /*#__PURE__*/ serializers.map((a) => a.$prefix$);

const startsWithPrefix = (str: string) => {
return prefixes.includes(str[0]);
};

const collectorSerializers = /*#__PURE__*/ serializers.filter((a) => a.$collect$);

Expand Down

0 comments on commit 2a338d0

Please sign in to comment.