[vite:singlefile] scriptCode.replaceAll is not a function
error during build:
TypeError: scriptCode.replaceAll is not a function
at replaceScript (file:///Users/username/Projects/project/node_modules/vite-plugin-singlefile/dist/esm/index.js:7:32)
at Object.generateBundle (file:///Users/username/Projects/project/node_modules/vite-plugin-singlefile/dist/esm/index.js:36:44)
at file:///Users/username/Projects/project/node_modules/rollup/dist/es/shared/rollup.js:22710:40
at processTicksAndRejections (internal/process/task_queues.js:95:5)
Doing some googling it turns out replaceAll() wasn't introduced until Node 15. I upgraded to 16 and it works now.
It's a pretty easy fix since 16 is the latest LTS, but I just wanted to report it in case anyone else is searching for the issue like I was.
When using Node 14 I get this error:
Doing some googling it turns out
replaceAll()
wasn't introduced until Node 15. I upgraded to 16 and it works now.It's a pretty easy fix since 16 is the latest LTS, but I just wanted to report it in case anyone else is searching for the issue like I was.