HudsyWudsy
HudsyWudsy3d ago

Errors in boilerplate code?

After running deno run --allow-read --allow-write --allow-env npm:create-vite-extra@latest I see the following errors. (It's important to note that on another computer, there are no errors whatsoever.) Why might I be getting these errors? 1. Question: vite.config.ts error By default, I get the following error from my vite.config.ts file. Is there a missing step upon installation that needs to be run?
Cannot find module '@deno/vite-plugin' or its corresponding type declarations.
There are types at '/Users/username/to-do-client/node_modules/@deno/vite-plugin/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
Cannot find module '@deno/vite-plugin' or its corresponding type declarations.
There are types at '/Users/username/to-do-client/node_modules/@deno/vite-plugin/dist/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting. Consider updating to 'node16', 'nodenext', or 'bundler'.
2. Question: JSX error Also by default, I get the JSX error of: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead.ts(2686). I understand that adding the import React from "react" statement would fix this, but I also know we don't need that statement in React anymore. (My apologies if these have already been answered--I just haven't been able to find related anwers.)
2 Replies
marvinh.
marvinh.3d ago
It sounds like you're have moduleResolution: "node" set in your tsconfig.json. This setting is only for users on Node 10.x or older (Node is at 20.x by now). It's pretty much always the wrong setting there. Instead you should change it to "bundler" like the error message hints at
HudsyWudsy
HudsyWudsy3d ago
I guess I'm also curious as to why a tsconfig.json file is not part of the boilerplate code. I have to manually create it.