paperjs / paper.js

The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey
http://paperjs.org
Other
14.45k stars 1.22k forks source link

Problems with NUXT3 #2056

Open SebastienCaunes opened 9 months ago

SebastienCaunes commented 9 months ago

When I use paper in a NUXT 3 component I have the following bug:

[Vue Router warn]: uncaught error during route navigation: Error: Cannot find module './node/self.js'

So I went to the source code of paper-full.js and had to change the line 35 self = self || require('./node/self.js');

by

self = self || require('paper/dist/node/self.js');

Then I had to do the same for extend.js further down.

Description/Steps to reproduce

Import paper in a dynamically loaded nuxt3 component it works fine the first time, then if you navigate in some pages and come back you get an error 500 defined above

Additional information

Sorry I'm not a javascript nor nuxt3 guru and I don't understand what's wrong Just want to report it as I lost time to find this bug and if it could be avoided for others it's fine.

thanks for this work tho

SebastienCaunes commented 9 months ago

I tried to setup a new project and the problem disappeared ...

SebastienCaunes commented 9 months ago

The problem is there again in my new project. It's driving me crazy

If I go directly to the page where the paper is instantiated I got the error (http://localhost:3000/configurator). If I go to home dir first then navigate to the page, it works.

SebastienCaunes commented 9 months ago

I found that this error is due to server side rendering. When I put ssr: false, in nuxt config file. Everything works fine.