Skip to content

Commit

Permalink
Fixes btoa unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
filipenevola committed Jan 6, 2021
1 parent 79529f5 commit 67066a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/hot-module-replacement/client.js
Expand Up @@ -115,7 +115,7 @@ function send(message) {

function connect() {
if (mustReload) {
// The page will reload, no reason to
// The page will reload, no reason to
// connect and show more logs in the console
return;
}
Expand Down Expand Up @@ -179,8 +179,13 @@ function walkTree(pathParts, tree) {
return walkTree(pathParts, _module);
}

// btoa with unicode support
function utoa(data) {
return btoa(unescape(encodeURIComponent(data)));
}

function createInlineSourceMap(map) {
return "//# sourceMappingURL=data:application/json;base64," + btoa(JSON.stringify(map));
return "//# sourceMappingURL=data:application/json;base64," + utoa(JSON.stringify(map));
}

function createModuleContent (code, map) {
Expand Down

0 comments on commit 67066a8

Please sign in to comment.