Skip to content

Commit

Permalink
fix(core): 修复代码中带有特殊字符时,unicode 转换失败
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Dec 31, 2022
1 parent 23efe42 commit fb0cb21
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export default defineConfig({
const content = readFileSync(path.resolve(__dirname, '../../dist/index.js')).toString();
writeFileSync(
path.resolve(__dirname, '../../dist/index.js'),
unescape(
content.replace(/\\u([\d\w]{4})/gi, function (match, grp) {

// eslint-disable-next-line no-eval
JSON.parse(
JSON.stringify(`${content}`).replace(/\\\\u([\d\w]{4})/gi, function (match, grp) {
return String.fromCharCode(parseInt(grp, 16));
})
)
Expand Down

0 comments on commit fb0cb21

Please sign in to comment.