Soft'N'Design Software
/
projects
/
trivabble.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9435c99
)
Rewrite const and let to var when serving js files from the dev server
author
Raphaël Jakse
<raphael.trivabble@jakse.fr>
Sun, 12 Apr 2020 18:14:37 +0000
(20:14 +0200)
committer
Raphaël Jakse
<raphael.trivabble@jakse.fr>
Sun, 12 Apr 2020 18:14:37 +0000
(20:14 +0200)
trivabble-server.js
patch
|
blob
|
blame
|
history
diff --git
a/trivabble-server.js
b/trivabble-server.js
index c92dd87217c05a5e104101d9f9fcfabad5e97d20..814447f8e6e5473249fe8e95e7df48f3a1ef2fb5 100644
(file)
--- a/
trivabble-server.js
+++ b/
trivabble-server.js
@@
-755,6
+755,12
@@
function handleRequest(request, response) {
for (const i in mimes) {
if (Object.prototype.hasOwnProperty.call(mimes, i) && request.url.endsWith(i)) {
mime = mimes[i];
+ if (i === ".js") {
+ contents = contents.toString().replace(
+ /(?<before>^|\s|\()(?:const|let)(?<after>\s)/gu,
+ "$1var$2"
+ );
+ }
break;
}
}