How to import npm module to a doctype page

hello I created this doctype and added some js to it so when the user edit some fields , some code happens . anyways I want to use a npm module I found online but it says (Cannot use import statement outside a module) .
PS : I am editing the js file of the doctype

1 Like

I don’t know much about js, but have you tryed frappe.require(path, callback) or require(module)? I’ve done some js imports with frappe.require before, but i know nothing about how to use npm modules, so, i can be completly wrong and out of topic hahaha
Btw, for some reasons the routes i used to use are not local routes, for example, to import something from the classic /public/js/ i would have to require assets/APP_NAME/js/FILENAME.js