Import Client API modules in JS Action

0
What is the proper way to import external modules for use in JS Actions?  I'm looking specifically at the dojo/query module.  This code:   import "mx-global"; import { Big } from "big.js"; import dojoQuery from "dojo/query"; // BEGIN EXTRA CODE // END EXTRA CODE /** * @returns {Promise.<void>} */ export async function JSA_DataGridHotkeys() { // BEGIN USER CODE var nodeList = dojoQuery(".mx-name-*"); console.log(nodeList); // END USER CODE }   gives me a compilation error saying "Module not found: Error: Can't resolve 'dojo/query'".  What is the proper syntax?
asked
1 answers
2

Hey Tyler,

You don't need to import dojo since it's core library by the Mendix client,

you just need to remove line of import and adjust using of dojoquery 

// BEGIN USER CODE

var elements = dojo.query(".mx-name-*");

alert(elements);

// END USER CODE

Hope this help you

Best regards, Slavko

 

answered