Skip to content

fix(define): incorrect raw expression value type in build#13003

Merged
bluwy merged 1 commit intovitejs:mainfrom
sun0day:fix/envInconsistent
Apr 30, 2023
Merged

fix(define): incorrect raw expression value type in build#13003
bluwy merged 1 commit intovitejs:mainfrom
sun0day:fix/envInconsistent

Conversation

@sun0day
Copy link
Member

@sun0day sun0day commented Apr 25, 2023

Description

fix #12866

{
  "define": {
     "import.meta.env.RAW_IDENTIFIER": "raw_id",
     "import.meta.env.RAW_EXPRESSION": "123",
     "import.meta.env.STRING": "\"123\""
  }
}

Before PR:

import.meta.env in build mode:

{"RAW_IDENTIFIER":"raw_id","RAW_EXPRESSION":"123","STRING":"\\"123\\""}

After PR:

import.meta.env in build mode:

{"RAW_IDENTIFIER":"raw_id","RAW_EXPRESSION":123,"STRING":"123"}

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this, I must've overlooked this before. I think if we want to further optimize this, we could perhaps reuse the serailizeDefine function in clientInjections.ts to avoid the regexes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handling dev and build config.define inconsistency

3 participants