Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

NutuiResolve 在 Linux 环境下出现路径拼接错误 #80

Open
JunSong opened this issue Apr 29, 2022 · 2 comments
Open

NutuiResolve 在 Linux 环境下出现路径拼接错误 #80

JunSong opened this issue Apr 29, 2022 · 2 comments

Comments

@JunSong
Copy link

JunSong commented Apr 29, 2022

NutuiResolve 这个方法有点问题。它会导致在 Linux 环境下找不到对应的路径。因为 Nutui 的包实际都是小写的。所以我自己写了个 resolve。希望官方可以改进一下:
image

@zh-lc
Copy link

zh-lc commented May 7, 2022

我也遇到这没问题,请问你写这个怎么用

@JunSong
Copy link
Author

JunSong commented May 9, 2022

我也遇到这没问题,请问你写这个怎么用

不用改源码啊。你就在 vite.config.js 里重写这个函数,然后在 plugins 那里加进去就可以了。
vite.config.js :

function NutuiResolve () {
return {
libraryName: '@nutui/nutui',
libraryNameChangeCase: 'pascalCase',
resolveStyle: (name) => {
name = name.toLowerCase()
return @nutui/nutui/dist/packages/${name}/index.scss
}
}
}
.....
createStyleImportPlugin({
resolves: [
NutuiResolve()
]
})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants