Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destructuring process.env stopped working in @quasar/app v2 #8361

Closed
suyundukov opened this issue Jan 22, 2021 · 2 comments
Closed

Destructuring process.env stopped working in @quasar/app v2 #8361

suyundukov opened this issue Jan 22, 2021 · 2 comments

Comments

@suyundukov
Copy link
Contributor

Describe the bug

After upgrading @quasar/app from v1 to v2, destructuring process.env doesn't work properly.
With IE11 support enabled I get error ReferenceError: process is not defined, without it variables are always undefined:

const { DEV, MODE } = process.env;

console.log(DEV, MODE); // undefined, undefined

Codepen/jsFiddle/Codesandbox (required)
https://codesandbox.io/s/destructuring-processenv-s1tjx?file=/src/App.vue

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project with @quasar/cli
  2. Add process.env destructuring anywhere
  3. Start the server
  4. See error

Expected behavior
In both situations (IE11 support mode on/off), destructuring works properly.

Platform (please complete the following information):
OS: macOS, Linux
Node: 10.20.1, 12.20.1
NPM: 6.14.10
Browsers: any

Additional context
Found the related bug report for webpack: webpack/webpack#5392, but it worked properly and still works in @quasar/app@1.
Also destructuring works properly if you extract exactly one property:

const { DEV } = process.env;

console.log(DEV); // spa|ssr

Strange.

@hawkeye64
Copy link
Member

@nurlansu This was done on purpose for security reasons so someone can't console.log your sensitive data. Use the full object path all the time.

@suyundukov
Copy link
Contributor Author

@hawkeye64 Thank you for your answer and your time. Sorry to bother.

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

No branches or pull requests

2 participants