Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.4] Change default SSR build directory #70

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
```

### Wrapping up
Expand Down Expand Up @@ -479,6 +479,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