Open markdalgleish opened 9 years ago
We just pulled all the Require code out because it was causing us grief as we were using a project without require js. Is there a way this could be a separate artefact?
I've passed the standalone: 'Pact'
option to Browserify, which means that if you're not using a module system, a Pact
global variable is created just like the code in master. In fact, the tests in master still pass if you point them at the dist version in my fork.
What I'm thinking is that, by moving to Browserify with UMD builds and using an HTTP client for browser+Node (e.g. axios), this project should be able to work in all environments without any special branching logic.
A worthy goal! I'm not much of a javascript developer, so I'm going to have to defer to the opinions of someone more experienced than me to review it. @BenSayers, @tarciosaraiva or @redbeard - can you put a second pair of eyes on this and see if it looks like the approach we want?
I am one of the developer from a team previously wanted to add node support to this project, back then about one month ago. We Identified require.js and HTTP client were the issues. Therefore, I completely agree with using UMD. As this project does not need to have dependency on any browser related objects. Regarding using Browserify & axios, it's just a choice of the tool. I believe the goal is 100% valid.
Cool. Will look at it tomorrow.
This looks good, will be accepting, just working out what to do about @BenSayers PR.
This pull request serves more as a conversation starter. The goal of this change is to allow this module to be used with different module systems and (eventually) to be used for Node projects too.
This commit converts the project to CommonJS, with a UMD build provided in
dist
.What are your thoughts? :)