Skip to content

Commit 5c258b2

Browse files
author
CI Fix
committed
lib/server-config.mjs
1 parent c668ad3 commit 5c258b2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/server-config.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
* Server config initialization utilities
33
*/
44

5+
import fs from 'fs-extra'
56
import { createRequire } from 'module'
6-
const require = createRequire(import.meta.url)
7-
const fs = require('fs-extra')
7+
// const require = createRequire(import.meta.url)
88
import path from 'path'
99
import { processHandlebarFile } from './common/template-utils.mjs'
1010
import { 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

1216
import 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)

0 commit comments

Comments
 (0)