Skip to content

Commit 902a2ef

Browse files
authored
Merge pull request #13 from laravel/fix-ssr-build
Fix manifest handling in SSR mode
2 parents d8860eb + 868ab9a commit 902a2ef

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ export default function laravel(config?: string|string[]|Partial<PluginConfig>):
170170
return null
171171
},
172172
writeBundle() {
173-
const manifestPath = path.resolve(resolvedConfig.root, resolvedConfig.build.outDir, 'manifest.json')
173+
const manifestConfig = resolveManifestConfig(resolvedConfig)
174+
175+
if (manifestConfig === false) {
176+
return;
177+
}
178+
179+
const manifestPath = path.resolve(resolvedConfig.root, resolvedConfig.build.outDir, manifestConfig)
174180
const manifest = JSON.parse(fs.readFileSync(manifestPath).toString())
175181
const newManifest = {
176182
...manifest,
@@ -259,3 +265,20 @@ function resolveOutDir(config: PluginConfig, ssr: boolean): string|undefined {
259265

260266
return path.join(config.publicDirectory, config.buildDirectory)
261267
}
268+
269+
function resolveManifestConfig(config: ResolvedConfig): string|false
270+
{
271+
const manifestConfig = config.build.ssr
272+
? config.build.ssrManifest
273+
: config.build.manifest;
274+
275+
if (manifestConfig === false) {
276+
return false
277+
}
278+
279+
if (manifestConfig === true) {
280+
return config.build.ssr ? 'ssr-manifest.json' : 'manifest.json'
281+
}
282+
283+
return manifestConfig
284+
}

0 commit comments

Comments
 (0)