Skip to content

Commit 3ab22e2

Browse files
authored
Update examples (kapi2289#31)
* Update examples * Update README.md
1 parent cfc5968 commit 3ab22e2

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

README.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -266,36 +266,23 @@ Here's an example for a TypeScript React app with HMR:
266266
</html>
267267
```
268268

269-
And here is the corresponding `vite.config.js`
269+
with the corresponding `vite.config.js`, which is recommended to create in the `ClientApp` directory:
270270

271271
```js
272272
import { defineConfig } from "vite";
273273
import react from "@vitejs/plugin-react";
274274
import laravel from "laravel-vite-plugin";
275-
import path from "path";
276-
import { mkdirSync } from "fs";
277-
278-
// Auto-initialize the default output directory
279-
const outDir = "../wwwroot/build";
280-
281-
mkdirSync(outDir, { recursive: true });
282275

283276
// https://vitejs.dev/config/
284277
export default defineConfig({
285278
plugins: [
286279
laravel({
287280
input: ["src/main.tsx"],
288-
publicDirectory: outDir,
281+
publicDirectory: "../wwwroot/",
289282
}),
290283
react(),
291284
],
292-
resolve: {
293-
alias: {
294-
"@": path.resolve(__dirname, "src"),
295-
},
296-
},
297285
build: {
298-
outDir,
299286
emptyOutDir: true,
300287
},
301288
});
@@ -322,24 +309,18 @@ Here's an example for a TypeScript Vue app with Hot Reload:
322309
</html>
323310
```
324311

325-
And here is the corresponding `vite.config.js`
312+
with the corresponding `vite.config.js`, which is recommended to create in the `ClientApp` directory:
326313

327314
```js
328315
import {defineConfig} from 'vite';
329316
import vue from '@vitejs/plugin-vue';
330317
import laravel from "laravel-vite-plugin";
331-
import path from "path";
332-
import {mkdirSync} from "fs";
333-
334-
const outDir = "../wwwroot/build";
335-
336-
mkdirSync(outDir, {recursive: true});
337318

338319
export default defineConfig({
339320
plugins: [
340321
laravel({
341322
input: ["src/app.ts"],
342-
publicDirectory: outDir,
323+
publicDirectory: "../wwwroot/",
343324
refresh: true,
344325
}),
345326
vue({
@@ -351,13 +332,7 @@ export default defineConfig({
351332
},
352333
}),
353334
],
354-
resolve: {
355-
alias: {
356-
"@": path.resolve(__dirname, "src"),
357-
},
358-
},
359335
build: {
360-
outDir,
361336
emptyOutDir: true,
362337
},
363338
});

0 commit comments

Comments
 (0)