Skip to content

Two.js is not competible with Node, or Browserify exactly #43

@tiye

Description

@tiye

I'm a fan of Node.js and I want to package twojs in my code with Browserify.
I tried to place the file build/two.js with a new generated package.json, then require it in a script.
Well, seems it doesn't work.. the _ object behaves strangely..

I found such code like this:
https://github.com/jonobr1/two.js/blob/master/src/two.js#L1304-L1310

  //exports to multiple environments
  if (typeof define === 'function' && define.amd)
  //AMD
  define(function(){ return Two; });
  else if (typeof module != "undefined" && module.exports)
  //Node
  module.exports = Two;

It says in the comments that CommonJS style is supported, I guess.
But it's broken.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions