Skip to content

env file load incorrect #10440

@iivu

Description

@iivu

Describe the bug

I have a .env file looks like this:

APP_SIGN_SALT="PICUE#3$LCDG56h$LBNOD3*1H6ER4Y#DN12G6Z3J"

But in my app, the env variable became this:

console.log(import.meta.env.APP_SIGN_SALT);  // =>PICUE#3*1H6ER4Y#DN12G6Z3J

In dotenv@16.0.3, the env variable is correct:

require('dotenv').config();
console.log(process.env.APP_SIGN_SALT); // => PICUE#3$LCDG56h$LBNOD3*1H6ER4Y#DN12G6Z3J

Reproduction

https://stackblitz.com/edit/vitejs-vite-j9ece2?file=src/App.vue

Steps to reproduce

No response

System Info

System:
    OS: macOS 12.3.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
    Memory: 779.70 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
    Yarn: 1.22.15 - ~/.nvm/versions/node/v16.13.1/bin/yarn
    npm: 8.5.5 - ~/.nvm/versions/node/v16.13.1/bin/npm
  Browsers:
    Chrome: 106.0.5249.103
    Firefox Developer Edition: 106.0
    Safari: 15.4

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions