xaviergonz / js-angusj-clipper

Polygon and line clipping and offsetting library (Javascript) - a port of Angus Johnson's clipper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import into Angular

danielfrunza opened this issue · comments

"ReferenceError: process is not defined" when try to "loadNativeClipperLibInstanceAsync" at:

var devMode = typeof "process" !== "undefined" && process.env && process.env.NODE_ENV !== "production";
in
(clipFunctions.js:7)

Try import * as clipperLib from "js-angusj-clipper/dist/web"

See #2

I think the reason for this issue is that typeof "process" is a string, which is never undefined. Some JS preprocessors catch this and just remove the check.

The web version also contains this line and thus importing it doesn't fix it.

I ran into this same issue using webpack with the web version and had to manually define process on the window/self in order to get it to work. I'm also using the exact same import as @xaviergonz mentioned. It would be nice to see this fixed.

I can provide a small example project demonstrating the problem if needed.

I can provide a small example project demonstrating the problem if needed.

that would be really helpful

https://github.com/blayzen-w/clipper-process-undefined

Let me know if I'm missing anything in there

I just tested and it seems to work ok now (I changed the emscripten build type a few weeks ago), so closing :)

Awesome! Thanks for working on it