Does anyone have any good resources on transformin...
# suitescript
b
Does anyone have any good resources on transforming a react script into a nice clean module to import into a SS 2.0 file?
j
NetSuite performs static analysis on client scripts when you create a client script or attach one to a suitelet. Since the server JS engine hasn't been updated for the better part of a decade, it bombs out when libraries like React use newer apis like WeakMap. As a result your client script needs to dynamically import react / react-dom to call ReactDOM.render
As a result, the best way to do it is to have the script file with your top level component also import ReactDOM and have an exported init function that calls ReactDOM.render That way in your actual netsuite client script you just have to dynamically import one file and call the init method Example here https://github.com/jeffreymkabot/netsuite-task-status/blob/master/src/task-status/lib/task_status_client.ts#L16-L24 https://github.com/jeffreymkabot/netsuite-task-status/blob/master/src/task-status/lib/task_status.tsx#L10-L15
b
@jkabot your README.md #2 is very helpful
👍 1
I completely forgot the idea that I'd have to include the libraries manually