Skip to content

Commit 4ebf70a

Browse files
committed
Add example SolidJS app
1 parent 5564be5 commit 4ebf70a

File tree

6 files changed

+281
-1
lines changed

6 files changed

+281
-1
lines changed

examples/solid/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Example (Solid)</title>
7+
</head>
8+
<body>
9+
<div id="solid-app"></div>
10+
<script type="module" src="/src/main.ts"></script>
11+
</body>
12+
</html>

examples/solid/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"type": "module",
3+
"private": true,
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vite build",
7+
"preview": "vite preview"
8+
},
9+
"dependencies": {
10+
"solid-js": "^1.8.7"
11+
},
12+
"devDependencies": {
13+
"vite": "^5.0.2",
14+
"vite-plugin-node-polyfills": "workspace:*",
15+
"vite-plugin-solid": "^2.8.0"
16+
}
17+
}

examples/solid/src/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// eslint-disable-next-line unicorn/prefer-node-protocol
2+
import { join } from 'path/posix'
3+
4+
document.querySelector('#solid-app')!.textContent = join('foo', 'bar')

examples/solid/vite.config.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig } from 'vite'
2+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
3+
import solid from 'vite-plugin-solid'
4+
5+
export default defineConfig({
6+
optimizeDeps: {
7+
force: true,
8+
},
9+
plugins: [
10+
nodePolyfills({
11+
overrides: {
12+
'path/posix': 'path-browserify',
13+
},
14+
}),
15+
// comment/uncomment it:
16+
solid(),
17+
],
18+
})

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@
6969
"test": "run-s test:build",
7070
"test:build": "run-p test:build:*",
7171
"test:build:react": "pnpm -C ./examples/react run build",
72+
"test:build:solid": "pnpm -C ./examples/solid run build",
7273
"test:build:vanilla": "pnpm -C ./examples/vanilla run build",
7374
"test:build:vue": "pnpm -C ./examples/vue run build",
7475
"test:dev:react": "pnpm -C ./examples/react run dev",
76+
"test:dev:solid": "pnpm -C ./examples/solid run dev",
7577
"test:dev:vanilla": "pnpm -C ./examples/vanilla run dev",
7678
"test:dev:vue": "pnpm -C ./examples/vue run dev",
7779
"typecheck": "run-p typecheck:*",

0 commit comments

Comments
 (0)