Skip to content

Commit

Permalink
perf: rn端sass文件引入路径包含别名时支持~,例如: @import ’~@/common/baseStyle.scss‘
Browse files Browse the repository at this point in the history
  • Loading branch information
moseszhou committed Feb 13, 2023
1 parent bc113c8 commit a4d8cfc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/taro-rn-style-transformer/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export function resolveStyle (id: string, opts: ResolveStyleOptions) {
} = opts
id = id.trim()
Object.keys(alias).forEach(key => {
if (id.startsWith(key)) {
id = id.replace(key, alias[key])
}
const str = `~${key}`
const reg = new RegExp('^' + (id.startsWith(str) ? str : key))
id = id.replace(reg, alias[key])
})

const { dir, name, ext: idExt } = path.parse(id)
Expand Down

0 comments on commit a4d8cfc

Please sign in to comment.