• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using third party node modules not working

New Here ,
Aug 23, 2017 Aug 23, 2017

Copy link to clipboard

Copied

Hi again folks, following my previous post I've managed to make some headway with my CEP extension, however I've hit a bit of a snag with using third party node modules.

Despite following the instructions on here it seems that including the third party module is not currently working, the most likely reason I can see for this is that when I add this line to the HEAD tag of my html file:

<script type="text/javascript">window.nodeRequire=window.require && window.require=undefined</script>

I am getting the following error in the console:

Screen Shot 2017-08-23 at 16.43.40.png

since I am requiring the module in my JSX file in the usual manner:

var module = require('some-module');

I would imagine that the broken line above is the cause.

I've been trying to debug the issue but as this problem seems to be specifically an Adobe extension issue I have so far been unsuccessful.

Can anyone save me some time (and hair) and tell me what the problem is?

Thanks

TOPICS
SDK

Views

478

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 23, 2017 Aug 23, 2017

As i described before jsx interacts with the InDesign and Extendscript DOM, you can't use Node Module in it. If you look at the documentation also, it specifically mentions.

CEP injects following symbols into the root HTML DOM

Whatever be the use case, as i had mentioned in the previous post you need to leverage the communication methods between jsx and js to get your work done. So if you want to use node module, use it in js and pass the result to jsx if that is to be further processed in the dom

...

Votes

Translate

Translate
Community Expert ,
Aug 23, 2017 Aug 23, 2017

Copy link to clipboard

Copied

As i described before jsx interacts with the InDesign and Extendscript DOM, you can't use Node Module in it. If you look at the documentation also, it specifically mentions.

CEP injects following symbols into the root HTML DOM

Whatever be the use case, as i had mentioned in the previous post you need to leverage the communication methods between jsx and js to get your work done. So if you want to use node module, use it in js and pass the result to jsx if that is to be further processed in the domain of InDesign and Extendscript DOM

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 24, 2017 Aug 24, 2017

Copy link to clipboard

Copied

LATEST

Thanks for your response Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines