File tree Expand file tree Collapse file tree 3 files changed +40
-13
lines changed Expand file tree Collapse file tree 3 files changed +40
-13
lines changed Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ module.exports = function (config, options) {
229229 if ( users && req . user && req . user . matchingUsername ) {
230230 res . append ( 'username' , req . user . matchingUsername ) ;
231231 }
232- if ( ! req . path . startsWith ( ` ${ mountPath } v2` ) ) {
232+ if ( ! req . path . startsWith ( '/v2' ) ) {
233233 res . send ( `<!DOCTYPE html>
234234 <html>
235235 <head>
@@ -247,7 +247,26 @@ module.exports = function (config, options) {
247247 </html>
248248 ` ) ;
249249 } else {
250- next ( ) ;
250+ if ( options . dev ) {
251+ next ( ) ;
252+ } else {
253+ res . send ( `<!doctype html>
254+ <html lang="en">
255+ <head>
256+ <base href="${ mountPath } v2/"/>
257+ <meta charset="UTF-8" />
258+ <link rel="icon" type="image/svg+xml" href="${ mountPath } v2/vite.bundle.svg" />
259+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
260+ <title>Express serve</title>
261+ <script type="module" crossorigin src="${ mountPath } v2/index.bundle.js"></script>
262+ <link rel="stylesheet" crossorigin href="${ mountPath } v2/index.bundle.css">
263+ </head>
264+ <body>
265+ <div id="root"></div>
266+ </body>
267+ </html>
268+ ` ) ;
269+ }
251270 }
252271 } ) ;
253272 } ) ;
Original file line number Diff line number Diff line change @@ -183,17 +183,19 @@ module.exports = options => {
183183 ) } `
184184 ) ;
185185 } ) ;
186- ViteExpress . config ( {
187- inlineViteConfig : {
188- base : '/v2/' ,
189- root : path . join ( __dirname , '../v2' ) ,
190- build : {
191- outDir : path . join ( __dirname , './v2' ) ,
186+ if ( dev ) {
187+ ViteExpress . config ( {
188+ inlineViteConfig : {
189+ base : `${ mountPath } /v2/` ,
190+ root : path . join ( __dirname , '../v2' ) ,
191+ build : {
192+ outDir : path . join ( __dirname , './v2' ) ,
193+ } ,
192194 } ,
193- } ,
194- mode : dev && fs . existsSync ( path . join ( __dirname , '../v2' ) ) ? 'development' : 'production' ,
195- } ) ;
196- ViteExpress . bind ( app , server ) ;
195+ mode : dev && fs . existsSync ( path . join ( __dirname , '../v2' ) ) ? 'development' : 'production' ,
196+ } ) ;
197+ ViteExpress . bind ( app , server ) ;
198+ }
197199 } else {
198200 // Start the server using SSL.
199201 const privateKey = fs . readFileSync ( configSSLKey ) ;
Original file line number Diff line number Diff line change @@ -5,8 +5,14 @@ import react from '@vitejs/plugin-react-swc';
55export default defineConfig ( {
66 plugins : [ react ( ) ] ,
77 build : {
8- outDir : '../Parse-Dashboard/v2' ,
8+ outDir : '../Parse-Dashboard/public/ v2' ,
99 emptyOutDir : true ,
10+ rollupOptions : {
11+ output : {
12+ entryFileNames : '[name].bundle.js' ,
13+ assetFileNames : '[name].bundle.[ext]' ,
14+ } ,
15+ } ,
1016 } ,
1117 base : '/v2/' ,
1218} ) ;
You can’t perform that action at this time.
0 commit comments