Skip to content

Commit

Permalink
Making vite and deno play nice
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwhitney committed May 27, 2024
1 parent dca6629 commit ca18ba0
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 37 deletions.
4 changes: 2 additions & 2 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react'
import React, { useState } from 'react'
import reactLogo from './assets/react.svg';
import './App.css'

Expand All @@ -18,7 +18,7 @@ function App() {
</div>
<h1>Vite + React</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>
<button onClick={() => setCount((count: number) => count + 1)}>
count is {count}
</button>
<p>
Expand Down
2 changes: 1 addition & 1 deletion client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { createRoot } from "react-dom/client";
import App from './App'
import App from './App.tsx'
import './index.css'

const container = document.getElementById("root")!;
Expand Down
13 changes: 11 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
"vite:build": "deno run -A --node-modules-dir npm:vite build"
},
"imports": {
"react": "npm:react",
"react-dom": "npm:react-dom"
"vite": "npm:vite@^5.2.11",
"vitejs/plugin-react": "npm:@vitejs/plugin-react@^4.3.0",
"react": "npm:react@^18.3.1",
"react-dom": "npm:react-dom@^18.3.1",
"@types/react": "npm:@types/react@^18.3.3"
},
"compilerOptions": {
"types": ["react", "react-dom", "@types/react", "vite/client"],
"lib": ["dom", "dom.iterable", "esnext", "deno.ns"],
"jsx": "react-jsx",
"jsxImportSource": "react"
}
}
26 changes: 24 additions & 2 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 0 additions & 25 deletions tsconfig.json

This file was deleted.

8 changes: 3 additions & 5 deletions vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { defineConfig } from 'npm:vite@^5.2.11'
import react from 'npm:@vitejs/plugin-react@^4.3.0'

import 'npm:react@^18.3.1'
import 'npm:react-dom@^18.3.1'
import { defineConfig } from "vite"
import react from "vitejs/plugin-react"
import "react"

// https://vitejs.dev/config/
export default defineConfig({
Expand Down

0 comments on commit ca18ba0

Please sign in to comment.