Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

public子目录嵌套生成错误 #23

Closed
nine-fox opened this issue Feb 14, 2023 · 3 comments
Closed

public子目录嵌套生成错误 #23

nine-fox opened this issue Feb 14, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@nine-fox
Copy link

nine-fox commented Feb 14, 2023

最新的0.8.1中,我的public目录是这样的:
public/textures/hdr/blouberg_sunrise_2_1k.hdr

但是最后的dist文件中不会生成br或者gz文件。

经调试发现问题出现在以下函数(utils.ts)中:

// [path][base].ext
export function replaceFileName(staticPath: string, rule: string | ((id: string) => string)) {
    const series = staticPath.split('/')
    const base = series.pop()
    const fileNameTempalte = typeof rule === 'function' ? rule(staticPath) : rule
    let path = series.filter((_, idx) => idx === len(series) - 1).join('/')
    if (len(path)) path = path + '/'

    console.log('staticPath', staticPath)
    console.log('series ', series)
    console.log('path ' + path)
    const ret = fileNameTempalte.replace(/\[path\]/, path).replace(/\[base\]/, base)

    console.log('final: ' + ret);
}

打印后出现:

staticPath textures/hdr/blouberg_sunrise_2_1k.hdr
series  [
  'textures',
  'hdr'
]
path hdr/
final: hdr/blouberg_sunrise_2_1k.hdr.br

最后的值不正确,应该是textures/hdr/blouberg_sunrise_2_1k.hdr.br才对

这个replace函数好像在其他地方也用了,不确定怎么修改,故保险起见还是提个issue吧 :)

@nine-fox nine-fox changed the title public目录子目录嵌套错误 public子目录嵌套生成错误 Feb 14, 2023
@nonzzz nonzzz added the bug Something isn't working label Feb 14, 2023
@nonzzz
Copy link
Owner

nonzzz commented Feb 14, 2023

感谢反馈。我会尽快修复这个bug.

@nonzzz
Copy link
Owner

nonzzz commented Feb 14, 2023

@nine-fox 0.8.2 已经发布。

@nonzzz nonzzz closed this as completed Feb 15, 2023
@nine-fox
Copy link
Author

@nonzzz 感谢!测试过了,没问题了,耶!:)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants