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) {
229
229
if ( users && req . user && req . user . matchingUsername ) {
230
230
res . append ( 'username' , req . user . matchingUsername ) ;
231
231
}
232
- if ( ! req . path . startsWith ( ` ${ mountPath } v2` ) ) {
232
+ if ( ! req . path . startsWith ( '/v2' ) ) {
233
233
res . send ( `<!DOCTYPE html>
234
234
<html>
235
235
<head>
@@ -247,7 +247,26 @@ module.exports = function (config, options) {
247
247
</html>
248
248
` ) ;
249
249
} 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
+ }
251
270
}
252
271
} ) ;
253
272
} ) ;
Original file line number Diff line number Diff line change @@ -183,17 +183,19 @@ module.exports = options => {
183
183
) } `
184
184
) ;
185
185
} ) ;
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
+ } ,
192
194
} ,
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
+ }
197
199
} else {
198
200
// Start the server using SSL.
199
201
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';
5
5
export default defineConfig ( {
6
6
plugins : [ react ( ) ] ,
7
7
build : {
8
- outDir : '../Parse-Dashboard/v2' ,
8
+ outDir : '../Parse-Dashboard/public/ v2' ,
9
9
emptyOutDir : true ,
10
+ rollupOptions : {
11
+ output : {
12
+ entryFileNames : '[name].bundle.js' ,
13
+ assetFileNames : '[name].bundle.[ext]' ,
14
+ } ,
15
+ } ,
10
16
} ,
11
17
base : '/v2/' ,
12
18
} ) ;
You can’t perform that action at this time.
0 commit comments