File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,13 +135,13 @@ class Chunk {
135135 }
136136 }
137137}
138- let btoa = ( ) => {
139- throw new Error ( "Unsupported environment: `window. btoa` or `Buffer` should be supported." ) ;
138+ let _btoa = ( ) => {
139+ throw new Error ( "Unsupported environment: `btoa` or `Buffer` should be supported." ) ;
140140} ;
141- if ( typeof window !== "undefined" && typeof window . btoa === "function" ) {
142- btoa = ( str ) => window . btoa ( unescape ( encodeURIComponent ( str ) ) ) ;
143- } else if ( typeof Buffer === "function" ) {
144- btoa = ( str ) => Buffer . from ( str , "utf-8" ) . toString ( "base64" ) ;
141+ if ( typeof Buffer === "function" ) {
142+ _btoa = ( str ) => Buffer . from ( str , "utf-8" ) . toString ( "base64" ) ;
143+ } else if ( typeof btoa === "function" ) {
144+ _btoa = btoa ;
145145}
146146class SourceMap {
147147 constructor ( properties ) {
@@ -156,7 +156,7 @@ class SourceMap {
156156 return JSON . stringify ( this ) ;
157157 }
158158 toUrl ( ) {
159- return "data:application/json;charset=utf-8;base64," + btoa ( this . toString ( ) ) ;
159+ return "data:application/json;charset=utf-8;base64," + _btoa ( this . toString ( ) ) ;
160160 }
161161}
162162function guessIndent ( code ) {
You can’t perform that action at this time.
0 commit comments