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.47k stars 1.22k forks source link

Paper.js with webpack #704

Closed HriBB closed 9 years ago

HriBB commented 9 years ago

Hello

I am using react-starter-kit which uses webpack. When I try to import/require paper, I get the following error

bojan@linux:~/www/react/MyApp$ gulp
[12:55:36] Using gulpfile ~/www/react/MyApp/gulpfile.js
[12:55:36] Starting 'build:watch'...
[12:55:36] Starting 'clean'...
[12:55:36] Finished 'clean' after 16 ms
[12:55:36] Starting 'build'...
[12:55:36] Starting 'vendor'...
[12:55:36] Starting 'assets'...
[12:55:36] Starting 'bundle'...
[12:55:36] Finished 'vendor' after 136 ms
    Asset    Size  Chunks             Chunk Names
server.js  570 kB       0  [emitted]  main
[12:55:44] Finished 'bundle' after 8.09 s
[12:55:47] 'assets' all files 30.95 kB
[12:55:47] Finished 'assets' after 11 s
[12:55:47] Finished 'build' after 11 s
[12:55:47] Finished 'build:watch' after 11 s
[12:55:47] Starting 'serve'...
paper { settings: { applyMatrix: true, handleSize: 4, hitTolerance: 0 },
  project: null,
  projects: [],
  tools: [],
  palettes: [],
  _id: 0 }
[12:55:56] Finished 'serve' after 8.75 s
[12:55:56] Starting 'sync'...
 Asset     Size  Chunks             Chunk Names
app.js  10.8 MB       0  [emitted]  main

WARNING in ./~/paper/dist/paper-node.js
require.extensions is not supported by webpack. Use a loader instead.

WARNING in ./~/paper/dist/paper-node.js
Critical dependencies:
12263:19-26 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/paper/dist/paper-node.js 12263:19-26

WARNING in ./~/paper/~/jsdom/~/acorn-globals/~/acorn/dist/walk.js
Critical dependencies:
1:503-510 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/paper/~/jsdom/~/acorn-globals/~/acorn/dist/walk.js 1:503-510

WARNING in ./~/paper/~/jsdom/~/acorn-globals/~/acorn/dist/acorn.js
Critical dependencies:
1:478-485 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
 @ ./~/paper/~/jsdom/~/acorn-globals/~/acorn/dist/acorn.js 1:478-485

WARNING in ./~/paper/~/request/~/hawk/~/hoek/lib/index.js
Critical dependencies:
403:34-60 the request of a dependency is an expression
 @ ./~/paper/~/request/~/hawk/~/hoek/lib/index.js 403:34-60

ERROR in ./~/paper/~/canvas/lib/bindings.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../build/Release/canvas in /home/bojan/www/react/MyApp/node_modules/paper/node_modules/canvas/lib
 @ ./~/paper/~/canvas/lib/bindings.js 2:17-51

ERROR in ./~/paper/~/jsdom/~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Cannot resolve module 'child_process' in /home/bojan/www/react/MyApp/node_modules/paper/node_modules/jsdom/node_modules/xmlhttprequest/lib
 @ ./~/paper/~/jsdom/~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36

ERROR in ./~/paper/~/request/~/hawk/~/sntp/lib/index.js
Module not found: Error: Cannot resolve module 'dgram' in /home/bojan/www/react/MyApp/node_modules/paper/node_modules/request/node_modules/hawk/node_modules/sntp/lib
 @ ./~/paper/~/request/~/hawk/~/sntp/lib/index.js 3:12-28

ERROR in ./~/paper/~/request/~/hawk/~/sntp/lib/index.js
Module not found: Error: Cannot resolve module 'dns' in /home/bojan/www/react/MyApp/node_modules/paper/node_modules/request/node_modules/hawk/node_modules/sntp/lib
 @ ./~/paper/~/request/~/hawk/~/sntp/lib/index.js 4:10-24
[RSK] Proxying: http://localhost:5000
[RSK] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.1.104:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.1.104:3001
 --------------------------------------
[12:55:56] Finished 'sync' after 702 ms
[12:55:56] Starting 'default'...
[12:55:56] Finished 'default' after 10 μs
[RSK] File changed: build/app.js

I'm fairly new to this whole webpack thing so I'm not sure if this is a config problem, paperjs problem on webpack problem. Any ideas?

lehni commented 9 years ago

Answered here: http://stackoverflow.com/questions/30576192/paper-js-with-webpack

davidgodzsak commented 2 years ago

@lehni I have the same issue and the stack overflow is not really helping me

Could you be more specific on how to solve the issue?