Skip to content

Commit 66e9664

Browse files
committed
Add example SolidJS app
1 parent 6c2be6c commit 66e9664

File tree

6 files changed

+461
-1
lines changed

6 files changed

+461
-1
lines changed

examples/solid/index.html

Lines changed: 12 additions & 0 deletions
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

Lines changed: 17 additions & 0 deletions
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

Lines changed: 4 additions & 0 deletions
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

Lines changed: 18 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@
7676
"test": "run-p test:build test:unit",
7777
"test:build": "run-p test:build:*",
7878
"test:build:react": "pnpm -C ./examples/react run build",
79+
"test:build:solid": "pnpm -C ./examples/solid run build",
7980
"test:build:vanilla": "pnpm -C ./examples/vanilla run build",
8081
"test:build:vue": "pnpm -C ./examples/vue run build",
8182
"test:dev:react": "pnpm -C ./examples/react run dev",
83+
"test:dev:solid": "pnpm -C ./examples/solid run dev",
8284
"test:dev:vanilla": "pnpm -C ./examples/vanilla run dev",
8385
"test:dev:vue": "pnpm -C ./examples/vue run dev",
8486
"test:unit": "vitest run --dir ./test",

0 commit comments

Comments
 (0)