Skip to content

Changes to .env contents during development not propagated #18210

@dsl101

Description

@dsl101

What happened?

Local configuration files (e.g. .env.local) are loaded when starting the dev server, and sent through to Vite and are available as proces.env and import.meta.env within the application.

Changing the contents of .env.local appears to trigger a dev server restart; the browser console reports, for example:

14:16:49.900 [vite] server connection lost. Polling for restart... client:865:14
14:16:49.907 [vite] connected from window 5ec46280-3f97-4379-89a6-814c30e07438:67:11
14:16:49.907 [vite] connected from window 5ec46280-3f97-4379-89a6-814c30e07438:67:11
14:16:49.908 [vite] new window visibility visible 5ec46280-3f97-4379-89a6-814c30e07438:63:12
14:16:49.908 [vite] new window visibility visible 5ec46280-3f97-4379-89a6-814c30e07438:63:12
14:16:50.272 Navigated to https://...:9000/ 
14:16:50.289 [vite] ping successful 2 [5ec46280-3f97-4379-89a6-814c30e07438:69:12](blob:https://...:9000/5ec46280-3f97-4379-89a6-814c30e07438)
14:16:50.646 [vite] connecting... [client:733:9](https://...:9000/@vite/client)
14:16:50.716 [vite] connected. [client:827:12](https://...:9000/@vite/client)
14:16:50.830 [Quasar] Running SPA. [client-entry.js:47:9](https://...:9000/.quasar/dev-spa/client-entry.js)

However, logging both in the app, and within quasar.conf.js envFilter() shows the original contents of .env.local are still used.

What did you expect to happen?

The .env.local file would be reloaded as part of the server restart process.

Reproduction URL

https://codesandbox.io/p/devbox/cocky-sun-jv88zz?workspaceId=ws_VJ6ApUkVugBmd5vnqjN4j4

How to reproduce?

  1. Open the codesandbox and then open a new tab for browser console (maybe it's available in codesandbox, but I just don't know it well enough; this link worked for me once the codesandbox was running: https://jv88zz-8123.csb.app/#/)
  2. See the IndexPage mounted hook reports the contents of the .env.local test variable
  3. Edit .env.local, changing the value of the variable
  4. See the server restart in the browser console, but the old data be reloaded
  5. (optional) CTRL+C in the terminal area, then npm start to restart the dev server. Refresh the browser, new data loaded.

Flavour

Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)

Areas

Quasar CLI Commands/Configuration (@quasar/cli | @quasar/app-webpack | @quasar/app-vite)

Platforms/Browsers

Firefox

Quasar info output

Relevant log output

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions