How do we add custom plugin in JS library into Frappe PAGE DESK Or Web Page

In Frappe when i tried to import an plugin like ag grid

./custom.js
I created the Custom.js and took bench build the js file is loading in browser but it says import error as below

import AgGrid from 'ag-grid-community';

it says in the console always

Uncaught SyntaxError: Cannot use import statement outside a module (at custom.js:2:1)

Hi:

Check this …
https://frappeframework.com/docs/user/en/basics/asset-bundling#importing-libraries-from-npm

And …
https://frappeframework.com/docs/user/en/python-api/hooks#desk

Hope this helps.

1 Like