Skip to content

Commit

Permalink
create-vite-app: update to match quickstart (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjg authored Mar 19, 2024
1 parent 9646637 commit 8c66f09
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
25 changes: 14 additions & 11 deletions packages/create-vite-app/template/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Meet Automerge</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>

</html>
1 change: 0 additions & 1 deletion packages/create-vite-app/template/public/vite.svg

This file was deleted.

20 changes: 6 additions & 14 deletions packages/create-vite-app/template/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import reactLogo from "./assets/react.svg"
import viteLogo from "/vite.svg"
import automergeLogo from "./assets/automerge.png"
import "./App.css"
import { AutomergeUrl } from "@automerge/automerge-repo"
Expand All @@ -16,27 +14,21 @@ function App({ docUrl }: { docUrl: AutomergeUrl }) {
return (
<>
<div>
<a href="automerge.org" target="_blank">
<img src={automergeLogo} className="logo" alt="Automerge logo" />
</a>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
<a href="https://automerge.org" target="_blank">
<img src={automergeLogo} className="logo" alt="Vite logo" />
</a>
</div>
<h1>Automerge + Vite + React</h1>
<h1>Meet Automerge</h1>
<div className="card">
<button onClick={() => changeDoc(d => d.counter.increment(1))}>
<button onClick={() => changeDoc((d) => d.counter.increment(1))}>
count is {doc && doc.counter.value}
</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
Open this page in another tab to watch the updates synchronize
</p>
</div>
<p className="read-the-docs">
Click on the Vite and React logos to learn more
Built with Automerge, Vite, React, and TypeScript
</p>
</>
)
Expand Down
1 change: 1 addition & 0 deletions packages/create-vite-app/template/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
}

a {
Expand Down
15 changes: 13 additions & 2 deletions packages/create-vite-app/template/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,18 @@ import react from "@vitejs/plugin-react"
import wasm from "vite-plugin-wasm"
import topLevelAwait from "vite-plugin-top-level-await"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [wasm(), topLevelAwait(), react()],
// customize this to your repo name for github pages deploy
base: "/",

build: {
target: "esnext",
},

plugins: [wasm(), react()],

worker: {
format: "es",
plugins: () => [wasm()],
},
})

0 comments on commit 8c66f09

Please sign in to comment.