Skip to content

Commit

Permalink
Add rspack example (#29)
Browse files Browse the repository at this point in the history
* feat: add rspack-react example

* feat: add script and style loading
  • Loading branch information
Valerioageno authored Apr 6, 2024
1 parent 06471d6 commit d3c0e44
Show file tree
Hide file tree
Showing 16 changed files with 3,255 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,7 @@ path = "examples/vite-react/server.rs"
[[example]]
name = "webpack"
path = "examples/webpack-react/server.rs"

[[example]]
name = "rspack-react"
path = "examples/rspack-react/server.rs"
24 changes: 24 additions & 0 deletions examples/rspack-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
12 changes: 12 additions & 0 deletions examples/rspack-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/react.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rspack + React + TS</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
26 changes: 26 additions & 0 deletions examples/rspack-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "rspack-react-ts-starter",
"private": true,
"version": "1.0.0",
"scripts": {
"dev": "NODE_ENV=development rspack serve",
"build": "pnpm build:client && pnpm build:ssr",
"build:client": "NODE_ENV=production rspack build",
"build:ssr": "rspack build -c ./ssr.config.js"
},
"dependencies": {
"fast-text-encoding": "^1.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@rspack/cli": "0.5.9",
"@rspack/core": "0.5.9",
"@rspack/plugin-react-refresh": "0.5.9",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
"file-loader": "^6.2.0",
"react-refresh": "^0.14.0",
"ts-loader": "^9.5.1"
}
}
Loading

0 comments on commit d3c0e44

Please sign in to comment.