midway-vite-view
Advanced tools
Comparing version 2.0.0-beta.5 to 2.0.0-beta.6
@@ -251,3 +251,5 @@ "use strict"; | ||
} | ||
else if (fileName === 'entry-server.js' || fileName === 'entry-server.jsx' || fileName === 'entry-server.tsx') { | ||
else if (fileName === 'entry-server.js' || | ||
fileName === 'entry-server.jsx' || | ||
fileName === 'entry-server.tsx') { | ||
this.config.entryServers.push(filePath); | ||
@@ -254,0 +256,0 @@ } |
import * as view from '@midwayjs/view'; | ||
import * as koa from '@midwayjs/koa'; | ||
import { ViteViewConfig } from './interface'; | ||
export declare class MidwayViteViewConfiguration { | ||
viewManager: view.ViewManager; | ||
app: koa.Application; | ||
viteViewConfig: ViteViewConfig; | ||
onReady(): Promise<void>; | ||
} |
@@ -22,3 +22,6 @@ "use strict"; | ||
async onReady() { | ||
this.app.useMiddleware(vite_middleware_1.ViteMiddleware); | ||
if (this.viteViewConfig.prod === false || | ||
!['prod', 'production'].includes(this.app.getEnv())) { | ||
this.app.useMiddleware(vite_middleware_1.ViteMiddleware); | ||
} | ||
this.viewManager.use('viteView', view_1.viteView); | ||
@@ -35,2 +38,6 @@ } | ||
], MidwayViteViewConfiguration.prototype, "app", void 0); | ||
__decorate([ | ||
(0, decorator_1.Config)('viteViewConfig'), | ||
__metadata("design:type", Object) | ||
], MidwayViteViewConfiguration.prototype, "viteViewConfig", void 0); | ||
MidwayViteViewConfiguration = __decorate([ | ||
@@ -37,0 +44,0 @@ (0, decorator_1.Configuration)({ |
@@ -84,11 +84,13 @@ "use strict"; | ||
tpl = path.resolve(this.prodPath, tpl); | ||
entry = locals.ssr !== false && entry | ||
? path.resolve(this.prodPath, entry).replace(/(\.[jt]sx)|(\.ts)$/, '.js') | ||
: ''; | ||
entry = | ||
locals.ssr !== false && entry | ||
? path | ||
.resolve(this.prodPath, entry) | ||
.replace(/(\.[jt]sx)|(\.ts)$/, '.js') | ||
: ''; | ||
} | ||
else { | ||
tpl = path.resolve(options.root, tpl); | ||
entry = locals.ssr !== false && entry | ||
? path.resolve(options.root, entry) | ||
: ''; | ||
entry = | ||
locals.ssr !== false && entry ? path.resolve(options.root, entry) : ''; | ||
} | ||
@@ -95,0 +97,0 @@ if (entry) { |
@@ -9,26 +9,28 @@ "use strict"; | ||
if (!vite) { | ||
vite = package_json_1.version.startsWith('2.') ? await (0, vite_1.createServer)({ | ||
configFile, | ||
server: { | ||
middlewareMode: 'ssr', | ||
watch: { | ||
// During tests we edit the files too fast and sometimes chokidar | ||
// misses change events, so enforce polling for consistency | ||
usePolling: true, | ||
interval: 100, | ||
vite = package_json_1.version.startsWith('2.') | ||
? await (0, vite_1.createServer)({ | ||
configFile, | ||
server: { | ||
middlewareMode: 'ssr', | ||
watch: { | ||
// During tests we edit the files too fast and sometimes chokidar | ||
// misses change events, so enforce polling for consistency | ||
usePolling: true, | ||
interval: 100, | ||
}, | ||
}, | ||
}, | ||
}) : await (0, vite_1.createServer)({ | ||
configFile, | ||
appType: 'custom', | ||
server: { | ||
middlewareMode: true, | ||
watch: { | ||
// During tests we edit the files too fast and sometimes chokidar | ||
// misses change events, so enforce polling for consistency | ||
usePolling: true, | ||
interval: 100, | ||
}) | ||
: await (0, vite_1.createServer)({ | ||
configFile, | ||
appType: 'custom', | ||
server: { | ||
middlewareMode: true, | ||
watch: { | ||
// During tests we edit the files too fast and sometimes chokidar | ||
// misses change events, so enforce polling for consistency | ||
usePolling: true, | ||
interval: 100, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
} | ||
@@ -35,0 +37,0 @@ return vite; |
{ | ||
"name": "midway-vite-view", | ||
"version": "2.0.0-beta.5", | ||
"version": "2.0.0-beta.6", | ||
"description": "midway vite ssr view vue react, midway 的 vite 服务端渲染和客户端渲染组件,支持vue3 react,服务端渲染失败后会自动执行客户端渲染。 Midway's Vite server rendering and client rendering components support vue3 React, Client rendering is automatically performed when server rendering fails。", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52668
702