Vue Typescript starter - import.meta.env unusuable
See original GitHub issueHey currently you cannot use Vite’s enviroment variables with the Vue typescript starter because the the tsconfig module option is set to “CommonJS”.
tsconfig.json
{
"compilerOptions": {
"strict": true,
"module": "CommonJS",
"target": "ES2020",
"lib": ["DOM"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"paths": {
"~/*": ["./src/*"]
},
},
"ts-node": {
"transpileOnly": true
}
}
Is there a way around this?
Issue Analytics
- State:
- Created 2 years ago
- Comments:21 (15 by maintainers)
Top Results From Across the Web
Typescript Types for import.meta.env - vue.js - Stack Overflow
I am now using a framework (vite) that injects environment variables into import.meta.env .
Read more >Env Variables and Modes - Vite
Vite exposes env variables on the special import.meta.env object. ... It will also replace these strings appearing in JavaScript strings and Vue templates....
Read more >[Solved]-Typescript Types for import.meta.env-Vue.js
ts should be placed in your src/ directory and you need a reference string at the top of the file. A complete, working...
Read more >Introducing Import-meta-env - Simple but strict solution to use ...
There are some questions I answered related to the problem this package is trying to solve: Pass environment variable into a Vue App...
Read more >Vue.js: Environment-Aware Code in TypeScript - Peter's
I ran into the situation that a certain single-page application was developed separately from the backend, which really isn't so unusual for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hm, seems like a bug in ts-node. But yea you’ll eventually find the problem by further digging 😃
On Mon, Jul 19, 2021 at 2:32 PM Stephen Samra @.***> wrote:
@deckchairlabs That is correct. In particular
import.meta
doesn’t exist inserver.js
. But better to have false positive than not being able to useimport.meta
at all.