Skip to content

Commit

Permalink
use string comp
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Aug 21, 2023
1 parent 40f58ee commit 873cd2f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next/src/build/analysis/get-page-static-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ const CLIENT_MODULE_LABEL =
const ACTION_MODULE_LABEL =
/\/\* __next_internal_action_entry_do_not_use__ ([^ ]+) \*\//

const CLIENT_DIRECTIVE_REGEX = /^use client$/
const SERVER_ACTION_DIRECTIVE_REGEX = /^use server$/
const CLIENT_DIRECTIVE = 'use client'
const SERVER_ACTION_DIRECTIVE = 'use server'

export type RSCModuleType = 'server' | 'client'
export function getRSCModuleInformation(
Expand Down Expand Up @@ -237,10 +237,10 @@ function checkExports(
if (node.type === 'ExpressionStatement') {
if (node.expression.type === 'StringLiteral') {
const directive = node.expression.value
if (CLIENT_DIRECTIVE_REGEX.test(directive)) {
if (CLIENT_DIRECTIVE === directive) {
directives.add('client')
}
if (SERVER_ACTION_DIRECTIVE_REGEX.test(directive)) {
if (SERVER_ACTION_DIRECTIVE === directive) {
directives.add('server')
}
}
Expand Down

0 comments on commit 873cd2f

Please sign in to comment.