mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-23 13:19:01 -05:00
add poly-decamp require shim
This commit is contained in:
parent
793d1ee2bc
commit
c72a9d017f
3 changed files with 9 additions and 5 deletions
|
@ -105,7 +105,8 @@ gulp.task('watch', function() {
|
|||
var b = browserify({
|
||||
entries: ['src/module/main.js'],
|
||||
standalone: 'Matter',
|
||||
plugin: [watchify]
|
||||
plugin: [watchify],
|
||||
transform: ['browserify-shim']
|
||||
});
|
||||
|
||||
var bundle = function() {
|
||||
|
@ -249,7 +250,7 @@ var build = function(options) {
|
|||
|
||||
var compiled = gulp.src(['src/module/main.js'])
|
||||
.pipe(through2.obj(function(file, enc, next){
|
||||
browserify(file.path, { standalone: 'Matter' })
|
||||
browserify(file.path, { standalone: 'Matter', transform: ['browserify-shim'] })
|
||||
.bundle(function(err, res){
|
||||
file.contents = res;
|
||||
next(null, file);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
],
|
||||
"devDependencies": {
|
||||
"browserify": "^12.0.1",
|
||||
"browserify-shim": "^3.8.12",
|
||||
"cheerio": "^0.19.0",
|
||||
"connect-livereload": "^0.5.4",
|
||||
"event-stream": "^3.3.2",
|
||||
|
@ -58,5 +59,8 @@
|
|||
"src",
|
||||
"build",
|
||||
"CHANGELOG.md"
|
||||
]
|
||||
],
|
||||
"browserify-shim": {
|
||||
"poly-decomp": "global:decomp"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ var Common = require('../core/Common');
|
|||
var Body = require('../body/Body');
|
||||
var Bounds = require('../geometry/Bounds');
|
||||
var Vector = require('../geometry/Vector');
|
||||
var decomp = require('poly-decomp');
|
||||
|
||||
(function() {
|
||||
|
||||
|
@ -213,8 +214,6 @@ var Vector = require('../geometry/Vector');
|
|||
removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01;
|
||||
minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10;
|
||||
|
||||
var decomp = window.decomp;
|
||||
|
||||
if (!decomp) {
|
||||
Common.warn('Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue