File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 22 * Server config initialization utilities
33 */
44
5+ import fs from 'fs-extra'
56import { createRequire } from 'module'
6- const require = createRequire ( import . meta. url )
7- const fs = require ( 'fs-extra' )
7+ // const require = createRequire(import.meta.url)
88import path from 'path'
99import { processHandlebarFile } from './common/template-utils.mjs'
1010import { copyTemplateDir } from './common/fs-utils.mjs'
11+ import { fileURLToPath } from 'url' ;
12+
13+ const __filename = fileURLToPath ( import . meta. url ) ;
14+ const __dirname = path . dirname ( __filename ) ;
1115
1216import debug from './debug.mjs'
1317
@@ -63,7 +67,8 @@ async function ensureWelcomePage (argv) {
6367 const { resourceMapper, templates, server, host } = argv
6468 const serverRootDir = resourceMapper . resolveFilePath ( host . hostname )
6569 const existingIndexPage = path . join ( serverRootDir , 'index.html' )
66- const packageData = require ( '../package.json' )
70+ // const packageData = require('../package.json')
71+ const packageData = JSON . parse ( fs . readFileSync ( path . join ( __dirname , '../package.json' ) ) )
6772
6873 if ( ! fs . existsSync ( existingIndexPage ) ) {
6974 fs . mkdirp ( serverRootDir )
You can’t perform that action at this time.
0 commit comments