NowChartJS creates a modified Chart.js Version for Service Now compatibilty.
The Rhino Intepreter which is used by Service Now to compile JavaScript code is not able to compile Template literals. All Template literals are removed after compilation. Since these are used by the Chart.js library, the compiler throws errors and the JavaScript can't be processed correclty.
NowChartJS transcribes all Template literals for Rhino compatibility.
Install all dependencies.
npm i
Setup the environment.
npm run setup
Drop the JS-Library into the input directory.
Then run:
npm run build
You will be asked whether the output should be minified (recommended).
The compiled files are written to the output directory. In addition, a changelog file is created in the output directory, which contains all changes from the compilation process.
The following example has been changed in the NowChartJS library compared to the original Chart.js library:
// Chart.js v4.4.2
// ❌ does not work with Rhino
return `${t.id}.${e.id}.${i.stack || i.type}`;
// Chart.js v4.4.2 (modified NowChartJS version)
// ✅ works with Rhino
return t.id + "." + e.id + "." + (i.stack || i.type);
Technically, NowChartJS can also be used for libraries other than Chart.js to convert template literals for Rhino compatibilty.