Playing around and trying to custom Module that wi...
# suitescript
j
Playing around and trying to custom Module that will hold functions shared across multiple Client Scripts, but I keep getting an
error.SuiteScriptModuleLoaderError
Full Error:
Copy code
Fail to evaluate script: {"type":"error.SuiteScriptModuleLoaderError","name":"UNEXPECTED_ERROR","message":"missing ; before statement (/SuiteScripts/Employee Equity/plx_cm_employee_equity_module.js#8)","stack":[]}
Client Script Sample:
Copy code
define(['N/error', 'N/query', 'SuiteScripts/Employee Equity/plx_cm_employee_equity_module'],
    
    function (error, query, plx_cm_employee_equity_module) {

        
        function pageInit(scriptContext) {
            log.debug('pageInit fired')
        }
Custom Module Sample:
Copy code
define([],
    function () {
        let counter = 0

        const incrementValue = () => {
            counter++
        }

        const getValue = () => {
            return counter
        }

        return {
            incrementValue : incrementValue,
            getValue : getValue
        };
    });
also tried
Copy code
define(['N/error', 'N/query', './plx_cm_employee_equity_module'],
m
Client scripts don’t support 2.1 syntax yet. Your module uses arrow notation instead of an explicit function declaration.
j
ahh, thank you
Yep, that worked. Thank you @mattdahse
m
You can have 2.1 client scripts as of 2021.2 IIRC