This topic contains 4 replies, has 0 voices, and was last updated by chanarbon 7 years, 8 months ago.

  • Author
    Posts
  • #1131

    starlingMark

    Hi All,

    I have a custom module that I’ve written. It contains some functions designed for server-side scripts (User Event & Suitelet) and some functions for client-side scripts.

    I can load the module just fine inside of my server-side scripts. I put it in the define block as such:

    Code:
    define([‘/SuiteScripts/util.js’],
    functon(util) {…
    When I try to do the exact same thing inside of a client script I get “Invalid Path; unable to load module /SuiteScripts/uitl.js: Module does not exist”.

    I’ve tried using the require statement instead to no avail. What am I missing?
    This is a cached copy. Click here to see the original post.

  • #1132

    david.smith

    remove the first forward slash

  • #1133

    chanarbon

    The forward slash is fine since you are using absolute page. Just using define([‘/SuiteScript/util’], function(util){…..})

  • #1134

    starlingMark

    So it turns out I did something foolish. For the record, david.smith & chanarbon are both correct.

    In my custom module I was trying to load a server-side-only module (ui/serverWidget). When trying to load this into the client-side I got the error. I was mis-interpreting the error message I was getting.

    Thanks all for your quick replies.

  • #1135

    chanarbon

    N/ui/serverWidget is a module limited only to server script which is common misconception.

You must be logged in to reply to this topic.