There are multiple ways to do this.
I prefer to keep javascript and styles separated and serve them as files, something like this:
example flow
[{"id":"6071f0af2ed211e6","type":"http in","z":"8aa61ed1e94ccd2a","name":"","url":"/mysite/lib/:file","method":"get","upload":false,"swaggerDoc":"","x":170,"y":140,"wires":[["9491f5feaa274515"]]},{"id":"dba413b62e31dbce","type":"http response","z":"8aa61ed1e94ccd2a","name":"","statusCode":"","headers":{},"x":790,"y":140,"wires":[]},{"id":"9491f5feaa274515","type":"switch","z":"8aa61ed1e94ccd2a","name":"","property":"req.params.file","propertyType":"msg","rules":[{"t":"eq","v":"alpine.min.js","vt":"str"},{"t":"eq","v":"echarts.min.js","vt":"str"},{"t":"eq","v":"styles.css","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":350,"y":140,"wires":[["9328b0100f258fea"],["074b686e07ec3001"],["e224b10b34c612f5"]]},{"id":"9328b0100f258fea","type":"template","z":"8aa61ed1e94ccd2a","name":"alpine.min.js","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"console.log('file: alpinejs')\n","output":"str","x":550,"y":100,"wires":[["dba413b62e31dbce"]]},{"id":"074b686e07ec3001","type":"template","z":"8aa61ed1e94ccd2a","name":"echarts.min.js","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"console.log('file: echarts')\n","output":"str","x":560,"y":140,"wires":[["dba413b62e31dbce"]]},{"id":"e224b10b34c612f5","type":"template","z":"8aa61ed1e94ccd2a","name":"styles.css","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"body{\n font-family:sans-serif;\n background:#999;\n}\nh1{color:#fff;}","output":"str","x":540,"y":180,"wires":[["dba413b62e31dbce"]]},{"id":"6d09e297c6b043bb","type":"template","z":"8aa61ed1e94ccd2a","name":"html","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n<head>\n <script src=\"lib/alpine.min.js\" type=\"text/javascript\" ></script>\n <script src=\"lib/echarts.min.js\" type=\"text/javascript\"></script>\n <link rel=\"stylesheet\" href=\"lib/styles.css\" >\n</head>\n<body>\n<h1>Test</h1>\n</body>\n\n</html>","output":"str","x":530,"y":260,"wires":[["dba413b62e31dbce"]]},{"id":"a83c4339d5cc13af","type":"http in","z":"8aa61ed1e94ccd2a","name":"","url":"/mysite","method":"get","upload":false,"swaggerDoc":"","x":370,"y":260,"wires":[["6d09e297c6b043bb"]]}]