Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError in Shader.js (Electron app) #2937

Closed
ignisphaseone opened this issue Sep 9, 2016 · 6 comments
Closed

Uncaught TypeError in Shader.js (Electron app) #2937

ignisphaseone opened this issue Sep 9, 2016 · 6 comments

Comments

@ignisphaseone
Copy link

I am using Electron (and by extension, npm and require), and am just trying to do basic tutorial code. There's a choke on making a new WebGLRenderer.

var PIXI = require('pixi.js');
console.log(PIXI); //successful, Object reported to console log.
var renderer = new PIXI.WebGLRenderer(256, 256); //breaks
// OR
var renderer = PIXI.autoDetectRenderer(256, 256); //breaks

Error for both of the above lines:
Uncaught TypeError: src.substring is not a function Shader.js:12

@kaansoral
Copy link

kaansoral commented Sep 9, 2016

I'm using pixi by importing it like any other script in html, using Electron, no issues

However, Electron does require some require/import related modifications to code (if you import them to the DOM, you have to manually convert module.exports's to global variable names, like $ for jQuery)

Nothing tangible to help you, but just my .02
Edit: My approach to Electron wasn't the right approach, but it worked, downside, importing scripts externally

@ivanpopelyshev
Copy link
Collaborator

Its problem with glsify, then. Like in that webpack issue somewhere here...

@ignisphaseone
Copy link
Author

webpack issue is #2922

@Adam-Meisen
Copy link

The workaround for this in webpack is to use the prebuilt version. If it works the same in electron, either require('pixi.js/bin/pixi.js'), or download pixi.js (or pixi.min.js) from here, drop it in your directory, and require('./pixi.js')

@englercj
Copy link
Member

Closing as it seems answered, people mentioned webpack workaround and you cannot simply include pixi's entry file using electron's require. You will need to include the built file in electron.

@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants