-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Vue Typescript starter - import.meta.env unusuable #101
Comments
Would |
Unfortunately neither of those suggestions seem to work. If I ignore the the typescript errors and log import.meta it is missing the env object as well. I'm not too clear on how this is all working with Vite (first time using it) but will continue to poke around to see if I can figure it out. |
Have you seen https://github.com/brillout/vite-plugin-ssr#env-files? |
See d478bec for how to change your Let me know if you have any other questions. |
@brillout, those changes to
My {
"compilerOptions": {
"target": "ESNext",
"lib": [
"DOM",
],
"types": [
"vite/client"
],
"baseUrl": ".",
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"module": "ES2020",
"moduleResolution": "Node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"noImplicitAny": false,
"paths": {
"src/*": [
"./src/*"
]
}
},
"include": [
"./src",
"./server"
],
"ts-node": {
"transpileOnly": true,
"compilerOptions": {
"module": "CommonJS"
}
}
} Any help would be appreciated, thanks. |
But your IDE is not complaining right? How is your Worst case: bisec between your project and the boilerplate until you find the root cause |
Correct, the IDE no longer shows it as an error. The |
Seems like something's wrong with your `ts-node` not picking up the
`package.json#ts-node` options.
Either bisec, or dig into ts-node `node_modules/` code to see why it
doesn't pick up the options.
…On Mon, Jul 19, 2021 at 1:50 PM Stephen Samra ***@***.***> wrote:
Correct, the IDE no longer shows it as an error. The yarn dev script is: ts-node
./server.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHVQRQUQIP6L5WVYNXC2WDTYQGR5ANCNFSM463XKSXQ>
.
|
I didn't think |
@brillout thanks, I will look into that. |
@deckchairlabs That is correct. In particular |
@brillout, you were right that Adding a {
"transpileOnly": undefined,
"compilerOptions": undefined
} However, when I inline those options in the "scripts": {
"dev": "ts-node --transpile-only --compiler-options '{\"module\":\"CommonJS\"}' ./server",
} ... it shows: {
"transpileOnly": true,
"compilerOptions": {
"module": "CommonJS"
}
} Unfortunately, even with those options set, I still get the same error so I'm still looking into it. Thanks for the help thus far though! |
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:
@brillout <https://github.com/brillout>, you were right that ts-node was
not picking up the tsconfig.json#ts-node options.
Adding a console.log inside ts-node for those options showed:
{
"transpileOnly": undefined,
"compilerOptions": undefined}
However, when I inline those options in the package.json script like so:
"scripts": {
"dev": "ts-node --transpile-only --compiler-options '{\"module\":\"CommonJS\"}' ./server",
}
... it shows:
{
"transpileOnly": true,
"compilerOptions": {
"module": "CommonJS"
}}
Unfortunately, even with those options set, I still get the same error so
I'm still looking into it. Thanks for the help thus far though!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHVQRWCCFFMUWFQJD7NTOLTYQLNVANCNFSM463XKSXQ>
.
|
Hello , I have also get The errors I get with react-ts begin with:
The tsconfig has
|
@chesterlaykin I can't reproduce with: $ pnpm create vite-plugin-ssr@latest
# Select `react-ts`
$ pnpm install
$ pnpm exec tsc --noEmit |
Here is a reproduction: . I ran: |
Alright, I could reproduce. It's a Vite bug; the best would be to create a new GitHub ticket over at Vite's repository and reference the reproduction you made. In the meantime, you can pin Vite to |
Thanks, I posted the issue and there is a workaround mentioned,
which works. |
@chesterlaykin Thanks for the update 👌. Tracking issues: #461 and vitejs/vite#10167. |
@stephensamra did you have any luck with that ? |
Hey currently you cannot use Vite's enviroment variables with the Vue typescript starter because the the tsconfig module option is set to "CommonJS".
Is there a way around this?
The text was updated successfully, but these errors were encountered: