I need some help as to why an included library, would not be referenced in production but is in development.
Below is what I’m seeing. Note the ReferenceError: marked is not defined. This is only applicable on the production environment, the same code running on development, does not fail (hence the green ticks).
Can you check in your setup scripts (click the cog on the left sidebar, then "JavaScript Configuration") and see if there is a line of code that requires marked in your production environment? If you don't see it, can you either add the line there or add a require line to your loop block to require marked? Please let me know if any of these options work for you.
You should be able to const marked = require('marked'); in your code or in setup scripts to require the marked library. All libraries you specify in your libraries list should be available to be required in code blocks.
Does it work if you use the marked library in a new separate JS code block?
Can you make a new JS code block with the following and let me know the output in Logs?
Hey @Paulo sorry for not coming back. I couldn't get it to play nicely, so ended up shifting to a different library which did work.
Now using markdown-it 14.0.0
Then in JavaScript configuration including:
const markdownit = require('markdown-it');
And within a loop in the workflow I'm simply calling:
markdownit().render(markdown)
Working as expected. I had followed similar require and inclusion steps for marked but couldn't get it to play nice so cut my losses and moved to an alternative package.