From 7467b1b165a47e1258cd40b8531ee8411694532d Mon Sep 17 00:00:00 2001 From: David Date: Thu, 20 Mar 2025 00:37:35 +0800 Subject: [PATCH] fix: fix icon production errors on Windows platform --- web/app/components/base/icons/script.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/icons/script.mjs b/web/app/components/base/icons/script.mjs index 1952a15251..2fef23632a 100644 --- a/web/app/components/base/icons/script.mjs +++ b/web/app/components/base/icons/script.mjs @@ -1,9 +1,10 @@ import path from 'node:path' import { access, appendFile, mkdir, open, readdir, rm, writeFile } from 'node:fs/promises' +import { fileURLToPath } from 'node:url' import { parseXml } from '@rgrove/parse-xml' import { camelCase, template } from 'lodash-es' -const __dirname = path.dirname(new URL(import.meta.url).pathname) +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const generateDir = async (currentPath) => { try { @@ -101,7 +102,7 @@ const generateImageComponent = async (entry, pathList) => { } `.trim()) - await writeFile(path.resolve(currentPath, `${fileName}.module.css`), `${componentCSSRender({ assetPath: path.join('~@/app/components/base/icons/assets', ...pathList.slice(2), entry) })}\n`) + await writeFile(path.resolve(currentPath, `${fileName}.module.css`), `${componentCSSRender({ assetPath: path.posix.join('~@/app/components/base/icons/assets', ...pathList.slice(2), entry) })}\n`) const componentRender = template(` // GENERATE BY script