thednp / kute.js

KUTE.js is a JavaScript animation engine for modern browsers.

Home Page:http://thednp.github.io/kute.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with Electron

JorgeHawkins opened this issue · comments

Hi, I've been trying to use KUTE.js with Electron Framework, but the following error triggers if trying to use relative paths for the JS files:

`internal/modules/cjs/loader.js:659 Uncaught Error: Cannot find module './kute.js'
Require stack:

  • C:\Users\jhawkins.admin\Desktop\DevelopmentTest\index.html
    at Module._resolveFilename (internal/modules/cjs/loader.js:659)
    at Function.Module._resolveFilename (C:\Users\jhawkins.admin\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\common\reset-search-paths.js:43)
    at Function.Module._load (internal/modules/cjs/loader.js:577)
    at Module.require (internal/modules/cjs/loader.js:715)
    at require (internal/modules/cjs/helpers.js:14)
    at kute-css.js:10
    at kute-css.js:16`

This obviously doesn't happen if the index file and the js files are located on the same directory.

Try

const KUTE = require(kute.js/kute.js');

image

The following error appears if I try to require it from the npm plugin folder.

Well it seems you're linking the script in the <HEAD> or you're trying to animate elements that aren't present withing the DOM, which isn't what this library was supposed to do

No, the script call is within the body element. However, I just found that a restriction inside my Electron initialize script was the culprit. For those who might have similar issues in the future, check the flags you have set up in your Electron app.

You can set up some flags in Electron through the appendSwitch function (specifically app.commandLine.appendSwitch) which might cause some conflict with KUTE.js and some other libraries. So that might be the first step.

Thank you so much for your support.