Skip to content

Example of how to use require() and cep_node.require() dynamically for Vue CLI 3 panels

Notifications You must be signed in to change notification settings

Inventsable/CEP-FS-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fstest

How to use any require module within a CEP extension's iframe (will update templates soon):

First, we need to change the CEP version to 8.0 in two places in manifest.xml:

  <!-- Inside <ExtensionManifest> -->
  Version="8.0"
  <!-- Inside <RequiredRuntime> -->
  Version="8.0"

Place the additional parameter enable-nodejs inside the iframe of ./public/index-dev.html at Line #10

  <iframe
    enable-nodejs
    src="http://localhost:8080"
    style="border: 0; width: 100vw; height: 100vh;"
  ></iframe>

Whenever require() is needed, we need to provide backdoors for both context:

// Before using require in any file, we need to define it like so:
const require = require || cep_node.require;

// Now this works for either context
const fs = require('fs')

Working examples for fs.stat() found in test.vue component here

About

Example of how to use require() and cep_node.require() dynamically for Vue CLI 3 panels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages