Closed notchris closed 5 months ago
I'm also having this issue.
I am seeing this too
Reproduction code:
import { Application, Graphics } from "@pixi/node"
import { writeFileSync } from "fs"
const app = new Application()
const square = new Graphics()
app.stage.addChild(square)
app.renderer.render(app.stage)
const base64Image = app.renderer.extract
.canvas(app.stage)
.toDataURL("image/png")
const base64Data = base64Image.replace(/^data:image\/png;base64,/, "")
const output = `./test.png`
writeFileSync(output, base64Data, "base64")
@bigtimebuddy Will this be available when pixi does another release? I tried to update the webworker-plugin directly, but was unable to get around the Worker issue.
Yeah, I'm trying to get 7.4.1 out this week. Hang tight should be resolved soon.
@bigtimebuddy Ah, you're awesome - thank you again!
@bigtimebuddy Wanted to check in on the status, I saw https://github.com/pixijs/pixijs/pull/10254 is awaiting a review. Are we still waiting on a PIXI release?
@notchris bump 👍
@shanealsingh TY for the bump, I think this got resolved in the newest release, right @bigtimebuddy ?
@notchris Did you try? Just tried it out n got:
class WorkerInstance extends Worker {
^
ReferenceError: Worker is not defined
:(
I just published pixi.js@7.4.2. Can you try that version which has the fix for this Worker issue
@bigtimebuddy I wonder if i'm doing something wrong.
yarn add @pixi/node
I have a simple test file:
import { Application } from '@pixi/node';
import express from 'express';
const app = express();
const port = 3000;
app.get('/', async (req, res) => {
// Create a new application
const app = new Application();
res.send('Hello World!');
});
app.listen(port, () => {
console.log(`Example app listening on port ${port}`);
});
Still seeing the same issue :(
Yeah, this is a publishing problem with dist-tags. Working on fixing now.
I verified that this is fixed. Here's the hello-world setup:
{
"name": "pixi-node-test",
"version": "1.0.0",
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@pixi/node": "^7.3.0"
}
}
import { Application, Assets, Sprite } from '@pixi/node';
import path from 'path';
import { writeFileSync } from 'fs';
// This package requires the new asset loader to be used.
// Initialize the new assets loader
await Assets.init();
// The application will create a renderer using WebGL. It will also setup the ticker
// and the root stage Container.
const app = new Application();
// load a sprite
const bunnyTexture = await Assets.load(path.join(process.cwd(), 'bunny.png'));
// create sprite from texture
const bunny = Sprite.from(bunnyTexture);
// Setup the position of the bunny
bunny.x = app.renderer.width / 2;
bunny.y = app.renderer.height / 2;
// Rotate around the center
bunny.anchor.x = 0.5;
bunny.anchor.y = 0.5;
// Add the bunny to the scene we are building.
app.stage.addChild(bunny);
// Listen for frame updates
app.ticker.add(() => {
// each frame we spin the bunny around a bit
bunny.rotation += 0.01;
});
// extract and save the stage
app.renderer.render(app.stage);
const base64Image = app.renderer.view.toDataURL('image/png');
const base64Data = base64Image.replace(/^data:image\/png;base64,/, '');
const output = `./test.png`;
writeFileSync(output, base64Data, 'base64');
process.exit(0);
@bigtimebuddy I did a quick test in my repo. Looks good. I don't see the Worker
error. Thank you for the quick response and fix :)
System: Macbook, Apple M2 Pro, MacOS Ventura
Issue: When creating a new Application class, I get the following error:
"@pixi/node": "^7.3.0",