Skip to content

Commit 40cadab

Browse files
authored
fix: fix icon generation error on Windows platform (#16254)
1 parent 6157f57 commit 40cadab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web/app/components/base/icons/script.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import path from 'node:path'
22
import { access, appendFile, mkdir, open, readdir, rm, writeFile } from 'node:fs/promises'
3+
import { fileURLToPath } from 'node:url'
34
import { parseXml } from '@rgrove/parse-xml'
45
import { camelCase, template } from 'lodash-es'
56

6-
const __dirname = path.dirname(new URL(import.meta.url).pathname)
7+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
78

89
const generateDir = async (currentPath) => {
910
try {
@@ -105,7 +106,7 @@ const generateImageComponent = async (entry, pathList) => {
105106
}
106107
`.trim())
107108

108-
await writeFile(path.resolve(currentPath, `${fileName}.module.css`), `${componentCSSRender({ assetPath: path.join('~@/app/components/base/icons/assets', ...pathList.slice(2), entry) })}\n`)
109+
await writeFile(path.resolve(currentPath, `${fileName}.module.css`), `${componentCSSRender({ assetPath: path.posix.join('~@/app/components/base/icons/assets', ...pathList.slice(2), entry) })}\n`)
109110

110111
const componentRender = template(`
111112
// GENERATE BY script

0 commit comments

Comments
 (0)