Refactor generateSite.js to use ES module syntax. Updated import statements and added support for obtaining the current directory name using fileURLToPath. This change aligns with the recent addition of "type": "module" in package.json.
This commit is contained in:
parent
8b5a39066f
commit
ac4cd9cba6
@ -1,6 +1,10 @@
|
|||||||
const fs = require('fs').promises;
|
import { promises as fs } from 'fs';
|
||||||
const path = require('path');
|
import path from 'path';
|
||||||
const http = require('http');
|
import http from 'http';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
// Get current directory name in ES modules
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
async function generateSite() {
|
async function generateSite() {
|
||||||
// Read the images data
|
// Read the images data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user