Skip to content

Commit 0b3b341

Browse files
committed
update installation page
1 parent 3a925ee commit 0b3b341

File tree

1 file changed

+21
-118
lines changed

1 file changed

+21
-118
lines changed

src/routes/getting-started/installation.mdx

Lines changed: 21 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -147,84 +147,54 @@ body {
147147
}
148148
```
149149

150-
151-
152150
## 7. Add Build Scripts
153151

154-
Update your `package.json` to include development and build scripts:
152+
Update your `package.json` to include the following scripts:
153+
- `dev` - Start the development server
154+
- `build` - Build the project for production
155+
- `start` - Start the production server
156+
- `serve` - Preview the production build
155157

156158
```json
157159
{
160+
//...
158161
"scripts": {
159162
"dev": "vite",
160163
"build": "vite build",
161-
"preview": "vite preview"
164+
"start": "vite",
165+
"serve": "vite preview"
162166
}
167+
// ...
163168
}
164169
```
165170

166171
## 8. Start Development Server
167172

168-
Launch the development server:
169-
170-
```sh title="npm" tab="package-manager"
171-
npm run dev
172-
```
173-
174-
```sh title="pnpm" tab="package-manager"
175-
pnpm dev
176-
```
177-
178-
```sh title="yarn" tab="package-manager"
179-
yarn dev
180-
```
181-
182-
```sh title="bun" tab="package-manager"
183-
bun run dev
173+
```package-run
174+
dev
184175
```
185176

186-
The development server will start on `http://localhost:3000`. Open this URL in your browser to view your application.
177+
## 9. Open in Browser
187178

188-
## Project Structure
189-
190-
Your manually created Solid project should now have this structure:
191-
192-
```
193-
solid-project/
194-
├── src/
195-
│ ├── App.jsx # Root component
196-
│ ├── index.jsx # Application entry point
197-
│ └── index.css # Global styles
198-
├── index.html # HTML template
199-
├── package.json # Project configuration
200-
└── vite.config.js # Vite build configuration
201-
```
179+
The development server will start on `http://localhost:3000`. Open this URL in your browser and begin developing your Solid application!
202180

203181
## TypeScript Setup (Optional)
204182

205183
To add TypeScript support to your project:
206184

207185
### 1. Install TypeScript Dependencies
208186

209-
```sh title="npm" tab="package-manager"
210-
npm install --save-dev typescript
211-
```
212-
213-
```sh title="pnpm" tab="package-manager"
214-
pnpm add -D typescript
215-
```
216-
217-
```sh title="yarn" tab="package-manager"
218-
yarn add --dev typescript
187+
```package-dev
188+
typescript
219189
```
220190

221-
```sh title="bun" tab="package-manager"
222-
bun add --dev typescript
191+
```sh title="npm" tab="package-manager"
192+
npm install --save-dev typescript
223193
```
224194

225195
### 2. Create TypeScript Configuration
226196

227-
Create a `tsconfig.json` file:
197+
Create a `tsconfig.json` file in your project root to configure TypeScript:
228198

229199
```json
230200
{
@@ -257,7 +227,7 @@ Rename your source files:
257227
- `src/index.jsx``src/index.tsx`
258228
- `src/App.jsx``src/App.tsx`
259229

260-
Update the script tag in `index.html`:
230+
In addition to updating the file extensions, ensure that your import statements reflect the new file types in the `index.html` file:
261231

262232
```html
263233
<script src="/src/index.tsx" type="module"></script>
@@ -269,72 +239,5 @@ With your development environment ready:
269239

270240
1. **Explore the generated code** in `src/App.jsx` or `src/App.tsx`
271241
2. **Modify components** and observe hot reloading in action
272-
3. **Review the [Basic Concepts](/concepts/intro-to-reactivity)** to understand Solid's reactivity system
273-
4. **Build your first component** following the [Getting Started guide](/getting-started/building-your-first-app)
274-
275-
## Alternative Build Tools
276-
277-
While Vite is the recommended build tool, Solid works with other bundlers:
278-
279-
### Webpack Setup
280-
281-
Install webpack and the Solid loader:
282-
283-
```sh
284-
npm install --save-dev webpack webpack-cli webpack-dev-server babel-loader @babel/core @babel/preset-env babel-preset-solid
285-
```
286-
287-
Create `webpack.config.js`:
288-
289-
```javascript
290-
const path = require('path');
291-
292-
module.exports = {
293-
entry: './src/index.jsx',
294-
mode: 'development',
295-
module: {
296-
rules: [
297-
{
298-
test: /\.(js|jsx)$/,
299-
exclude: /node_modules/,
300-
use: {
301-
loader: 'babel-loader',
302-
options: {
303-
presets: ['@babel/preset-env', 'babel-preset-solid']
304-
}
305-
}
306-
}
307-
]
308-
},
309-
resolve: {
310-
extensions: ['.js', '.jsx']
311-
},
312-
output: {
313-
path: path.resolve(__dirname, 'dist'),
314-
filename: 'bundle.js'
315-
},
316-
devServer: {
317-
static: path.join(__dirname, 'public'),
318-
port: 3000
319-
}
320-
};
321-
```
322-
323-
### Rollup Setup
324-
325-
Install Rollup and the Solid plugin:
326-
327-
```sh
328-
npm install --save-dev rollup @rollup/plugin-babel @rollup/plugin-node-resolve rollup-preset-solid
329-
```
330-
331-
Create `rollup.config.js`:
332-
333-
```javascript
334-
import { withSolid } from 'rollup-preset-solid';
335-
336-
export default withSolid({
337-
input: 'src/index.jsx',
338-
targets: ['esm', 'cjs'],
339-
});
340-
```
242+
3. **Review the [Basic Concepts](/reactivity/basics)** to understand Solid's reactivity system
243+
4. Learn to **build your first component** with the [Basics of Components](/components/basics) guide

0 commit comments

Comments
 (0)