Skip to content

Commit

Permalink
fix decomp require
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Nov 24, 2020
1 parent 5a0079d commit 0af1645
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/factory/Bodies.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ var Vector = require('../geometry/Vector');
* @return {body}
*/
Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea) {
var decomp = global.decomp || require('poly-decomp'),
var globals = typeof global !== 'undefined' ? global : window,
decomp,
body,
parts,
isConvex,
Expand All @@ -207,6 +208,12 @@ var Vector = require('../geometry/Vector');
v,
z;

try {
decomp = globals.decomp || require('poly-decomp');
} catch (e) {
// decomp is undefined
}

options = options || {};
parts = [];

Expand Down

0 comments on commit 0af1645

Please sign in to comment.