@harpy-js/core 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/app-setup.js +8 -6
- package/package.json +1 -1
- package/src/core/app-setup.ts +10 -12
package/dist/core/app-setup.js
CHANGED
|
@@ -64,14 +64,16 @@ async function configureHarpyApp(app, opts = {}) {
|
|
|
64
64
|
console.warn("[harpy-core] optional dependency `@fastify/cookie` is not installed; skipping cookie registration.");
|
|
65
65
|
}
|
|
66
66
|
if (fastifyStatic) {
|
|
67
|
-
await fastify.register(fastifyStatic, {
|
|
68
|
-
root: path.join(process.cwd(), distDir),
|
|
69
|
-
prefix: "/",
|
|
70
|
-
decorateReply: false,
|
|
71
|
-
});
|
|
72
67
|
if (publicDir) {
|
|
73
68
|
await fastify.register(fastifyStatic, {
|
|
74
|
-
root: path.join(process.cwd(), publicDir),
|
|
69
|
+
root: [path.join(process.cwd(), publicDir), path.join(process.cwd(), distDir)],
|
|
70
|
+
prefix: "/",
|
|
71
|
+
decorateReply: false,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
await fastify.register(fastifyStatic, {
|
|
76
|
+
root: path.join(process.cwd(), distDir),
|
|
75
77
|
prefix: "/",
|
|
76
78
|
decorateReply: false,
|
|
77
79
|
});
|
package/package.json
CHANGED
package/src/core/app-setup.ts
CHANGED
|
@@ -72,21 +72,19 @@ export async function configureHarpyApp(
|
|
|
72
72
|
// This is important: hydration chunks are expected at the root ("/").
|
|
73
73
|
// Use absolute path to be robust when invoked from different CWDs.
|
|
74
74
|
if (fastifyStatic) {
|
|
75
|
-
//
|
|
76
|
-
// This is important: hydration chunks are expected at the root ("/").
|
|
77
|
-
// Use absolute path to be robust when invoked from different CWDs.
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
79
|
-
await fastify.register(fastifyStatic, {
|
|
80
|
-
root: path.join(process.cwd(), distDir),
|
|
81
|
-
prefix: "/",
|
|
82
|
-
decorateReply: false,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// If publicDir is provided, register it as well for public assets
|
|
75
|
+
// If publicDir is provided, register both directories
|
|
86
76
|
if (publicDir) {
|
|
87
77
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
88
78
|
await fastify.register(fastifyStatic, {
|
|
89
|
-
root: path.join(process.cwd(), publicDir),
|
|
79
|
+
root: [path.join(process.cwd(), publicDir), path.join(process.cwd(), distDir)],
|
|
80
|
+
prefix: "/",
|
|
81
|
+
decorateReply: false,
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
// Only register dist directory
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
86
|
+
await fastify.register(fastifyStatic, {
|
|
87
|
+
root: path.join(process.cwd(), distDir),
|
|
90
88
|
prefix: "/",
|
|
91
89
|
decorateReply: false,
|
|
92
90
|
});
|