-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
fix: partially for css modules #98
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "waku-example", | ||
"version": "0.1.0", | ||
"type": "module", | ||
"private": true, | ||
"scripts": { | ||
"dev": "waku dev --with-ssr", | ||
"build": "waku build", | ||
"start": "waku start --with-ssr" | ||
}, | ||
"dependencies": { | ||
"express": "^4.18.2", | ||
"react": "18.3.0-canary-7118f5dd7-20230705", | ||
"react-dom": "18.3.0-canary-7118f5dd7-20230705", | ||
"react-server-dom-webpack": "18.3.0-canary-7118f5dd7-20230705", | ||
"waku": "0.13.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^18.2.8", | ||
"@types/react-dom": "^18.2.4", | ||
"typescript": "^5.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.title { | ||
background-color: pink; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// @ts-expect-error no types | ||
import styles from "./App.module.css"; | ||
import { Counter } from "./Counter.js"; | ||
|
||
const App = ({ name = "Anonymous" }) => { | ||
return ( | ||
<div style={{ border: "3px red dashed", margin: "1em", padding: "1em" }}> | ||
<h1 className={styles.title}>Hello {name}!!</h1> | ||
<h3>This is a server component.</h3> | ||
<Counter /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use client"; | ||
|
||
import { useState } from "react"; | ||
|
||
export const Counter = () => { | ||
const [count, setCount] = useState(0); | ||
return ( | ||
<div style={{ border: "3px blue dashed", margin: "1em", padding: "1em" }}> | ||
<p>Count: {count}</p> | ||
<button onClick={() => setCount((c) => c + 1)}>Increment</button> | ||
<h3>This is a client component.</h3> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { defineEntries } from "waku/server"; | ||
|
||
export default defineEntries( | ||
// getEntry | ||
async (id) => { | ||
switch (id) { | ||
case "App": | ||
return import("./components/App.js"); | ||
default: | ||
return null; | ||
} | ||
}, | ||
// getBuildConfig | ||
async () => { | ||
return { | ||
"/": { | ||
elements: [["App", { name: "Waku" }]], | ||
}, | ||
}; | ||
}, | ||
// getSsrConfig | ||
async (pathStr) => { | ||
switch (pathStr) { | ||
case "/": | ||
return { element: ["App", { name: "Waku" }] }; | ||
default: | ||
return null; | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Waku example</title> | ||
<style> | ||
@keyframes spinner { | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
.spinner { | ||
width: 36px; | ||
height: 36px; | ||
margin: auto; | ||
border: 2px solid #ddd; | ||
border-top-color: #222; | ||
border-radius: 50%; | ||
animation: spinner 1s linear infinite; | ||
} | ||
#root > .spinner { | ||
margin-top: calc(50% - 18px); | ||
} | ||
</style> | ||
<link rel="stylesheet" href="/components/App.module.css" /> | ||
</head> | ||
<body> | ||
<!--placeholder1--> | ||
<div id="root"> | ||
<div class="spinner"></div> | ||
</div> | ||
<!--/placeholder1--> | ||
<script src="/main.tsx" async type="module"></script> | ||
<!--placeholder2--> | ||
<!--/placeholder2--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { StrictMode } from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { serve } from "waku/client"; | ||
|
||
const App = serve<{ name: string }>("App"); | ||
const rootElement = ( | ||
<StrictMode> | ||
<App name="Waku" /> | ||
</StrictMode> | ||
); | ||
|
||
createRoot(document.getElementById("root")!).render(rootElement); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"target": "esnext", | ||
"downlevelIteration": true, | ||
"esModuleInterop": true, | ||
"module": "nodenext", | ||
"skipLibCheck": true, | ||
"noUncheckedIndexedAccess": true, | ||
"exactOptionalPropertyTypes": true, | ||
"jsx": "react-jsx" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack. We shouldn't need it. Let's live with it in the mean time and look for proper fix later. We need someone to help on it.