integrating libraries into now experience framework

Singularity
Tera Expert

Hi,

 

I am messing around with the Now CLI and the Now Experience Framework to see what it is capable of. I have managed to download and set up the CLI, create a project and create simple components.

 

I have tried introducing an external library (Chart.js) through npm install and when I import it into a component I immediately get an error during compiling it: 

Module parse failed: \node_modules\chart.js\dist\chart.js Unexpected token (6613:12)
-> static defaults = {};
You may need an appropriate loader to handle this file type.

I think I need to change the build & compilation process because Chart.js is using TypeScript as well as new JS syntax that may not automatically be handled by the default configuration, however I don't even know where to begin doing that.

 

I do not see documentation for now experience supported libraries, or documentation around changing parts of the build & deploy process to support external libraries. It would be very helpful if these existed.

 

Has anyone integrated external libraries? Has anyone looked into changing the build & deploy process to work with external libraries? How did you do it and what library/technology did you use?

1 REPLY 1

Ramesh Lohar
Kilo Guru


As of now, ServiceNow's Now Experience Framework and Now CLI are still in their early stages and there are certain limitations. Here are some points to consider:

- The Now Experience Framework currently does not support the direct import of external libraries like Chart.js. This is due to the security model of the Now Experience UI Framework which restricts the use of third-party libraries.

- The build and deploy process is managed by the Now CLI and it's not currently possible to modify this process to support external libraries.

- ServiceNow provides a set of pre-built components and libraries that can be used to build Now Experience components. These are designed to work seamlessly with the Now Experience Framework.

- If you need to create charts or graphs, you might want to consider using the out-of-the-box components provided by ServiceNow or building your own custom components using the provided libraries.

- ServiceNow is continuously improving the Now Experience Framework and Now CLI, so it's possible that support for external libraries may be added in the future.

- For any specific requirements or issues, it's recommended to reach out to ServiceNow's customer support or community forums for assistance.

In summary:

- Now Experience Framework currently does not support direct import of external libraries.
- The build and deploy process cannot be modified to support external libraries.
- Use ServiceNow's pre-built components and libraries for building Now Experience components.
- Consider using out-of-the-box components or building custom components for charts or graphs.
- Reach out to ServiceNow's customer support or community forums for specific requirements or issues.

For ServiceNow Live Classes, Books, Sample Resumes, Interview Questions, CSA Quizzes.
And getting better services's on ServiceNow you can visits our website.
Please visit : https://nowkb.com/home
Our Website :https://nowkb.com/home
nowKB.com