@mantiq/vite 0.5.3 → 0.5.4
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/package.json +1 -1
- package/src/ViteServiceProvider.ts +10 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ServiceProvider, ConfigRepository } from '@mantiq/core'
|
|
1
|
+
import { ServiceProvider, ConfigRepository, HttpKernel } from '@mantiq/core'
|
|
2
2
|
import { Vite } from './Vite.ts'
|
|
3
3
|
import { ServeStaticFiles } from './middleware/ServeStaticFiles.ts'
|
|
4
4
|
|
|
@@ -44,5 +44,14 @@ export class ViteServiceProvider extends ServiceProvider {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
await vite.initialize()
|
|
47
|
+
|
|
48
|
+
// Register 'static' middleware and prepend to global stack for asset serving
|
|
49
|
+
try {
|
|
50
|
+
const kernel = this.app.make(HttpKernel)
|
|
51
|
+
kernel.registerMiddleware('static', ServeStaticFiles)
|
|
52
|
+
kernel.prependGlobalMiddleware('static')
|
|
53
|
+
} catch {
|
|
54
|
+
// HttpKernel may not be available in CLI context
|
|
55
|
+
}
|
|
47
56
|
}
|
|
48
57
|
}
|