Skip to content

Commit

Permalink
[0.4] Change default SSR build directory (#70)
Browse files Browse the repository at this point in the history
* Move default SSR build directory

* Remove unnecessary npm script
  • Loading branch information
jessarcher authored Jul 11, 2022
1 parent 0bc037e commit 85c6932
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ You may wish to add the following additional scripts to your `package.json`:
If you prefer to build your assets on deploy instead of committing them to your repository, you may wish to add the SSR output directory to your `.gitignore` file:

```gitignore
/storage/ssr
/bootstrap/ssr
```

You may start the SSR server using `node`:

```sh
node storage/ssr/ssr.js
node bootstrap/ssr/ssr.js
```

### Optional: Expose Vite port when using Laravel Sail
Expand Down Expand Up @@ -489,6 +489,6 @@ rm vite.config.js
You may also wish to remove any `.gitignore` paths you are no longer using:

```gitignore
- /bootstrap/ssr
- /public/build
- /storage/ssr
```
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"build-plugin": "rm -rf dist && tsc && cp src/dev-server-index.html dist/",
"build-inertia-helpers": "rm -rf inertia-helpers && tsc --project tsconfig.inertia-helpers.json",
"lint": "eslint --ext .ts ./src ./tests",
"ssr:serve": "vite build --ssr && node storage/ssr/ssr.js",
"test": "vitest run"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface PluginConfig {
/**
* The directory where the SSR bundle should be written.
*
* @default 'storage/ssr'
* @default 'bootstrap/ssr'
*/
ssrOutputDirectory?: string

Expand Down Expand Up @@ -305,7 +305,7 @@ function resolvePluginConfig(config: string|string[]|PluginConfig): Required<Plu
publicDirectory: config.publicDirectory ?? 'public',
buildDirectory: config.buildDirectory ?? 'build',
ssr: config.ssr ?? config.input,
ssrOutputDirectory: config.ssrOutputDirectory ?? 'storage/ssr',
ssrOutputDirectory: config.ssrOutputDirectory ?? 'bootstrap/ssr',
refresh: config.refresh ?? false,
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe('laravel-vite-plugin', () => {
const ssrConfig = plugin.config({ build: { ssr: true } }, { command: 'build', mode: 'production' })
expect(ssrConfig.base).toBe('/build/')
expect(ssrConfig.build.manifest).toBe(false)
expect(ssrConfig.build.outDir).toBe('storage/ssr')
expect(ssrConfig.build.outDir).toBe('bootstrap/ssr')
expect(ssrConfig.build.rollupOptions.input).toBe('resources/js/ssr.js')
})

Expand Down

0 comments on commit 85c6932

Please sign in to comment.