File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ gulp.task('watch', function() {
105105 var b = browserify ( {
106106 entries : [ 'src/module/main.js' ] ,
107107 standalone : 'Matter' ,
108- plugin : [ watchify ]
108+ plugin : [ watchify ] ,
109+ transform : [ 'browserify-shim' ]
109110 } ) ;
110111
111112 var bundle = function ( ) {
@@ -249,7 +250,7 @@ var build = function(options) {
249250
250251 var compiled = gulp . src ( [ 'src/module/main.js' ] )
251252 . pipe ( through2 . obj ( function ( file , enc , next ) {
252- browserify ( file . path , { standalone : 'Matter' } )
253+ browserify ( file . path , { standalone : 'Matter' , transform : [ 'browserify-shim' ] } )
253254 . bundle ( function ( err , res ) {
254255 file . contents = res ;
255256 next ( null , file ) ;
Original file line number Diff line number Diff line change 2121 ],
2222 "devDependencies" : {
2323 "browserify" : " ^12.0.1" ,
24+ "browserify-shim" : " ^3.8.12" ,
2425 "cheerio" : " ^0.19.0" ,
2526 "connect-livereload" : " ^0.5.4" ,
2627 "event-stream" : " ^3.3.2" ,
5859 " src" ,
5960 " build" ,
6061 " CHANGELOG.md"
61- ]
62+ ],
63+ "browserify-shim" : {
64+ "poly-decomp" : " global:decomp"
65+ }
6266}
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ var Common = require('../core/Common');
1818var Body = require ( '../body/Body' ) ;
1919var Bounds = require ( '../geometry/Bounds' ) ;
2020var Vector = require ( '../geometry/Vector' ) ;
21+ var decomp = require ( 'poly-decomp' ) ;
2122
2223( function ( ) {
2324
@@ -213,8 +214,6 @@ var Vector = require('../geometry/Vector');
213214 removeCollinear = typeof removeCollinear !== 'undefined' ? removeCollinear : 0.01 ;
214215 minimumArea = typeof minimumArea !== 'undefined' ? minimumArea : 10 ;
215216
216- var decomp = window . decomp ;
217-
218217 if ( ! decomp ) {
219218 Common . warn ( 'Bodies.fromVertices: poly-decomp.js required. Could not decompose vertices. Fallback to convex hull.' ) ;
220219 }
You can’t perform that action at this time.
0 commit comments