I have a script I am requiring from a Node.js script, which I want to keep JavaScript engine independent.  For example, I want to do exports.x = y; only if it’s running under Node.js. How can I perform this test?    When posting this question, I...
I am using the following closure pattern to modularise my code:  (function(root) {   // MODULE CODE HERE    if (typeof module !== 'undefined' && module.exports) { // CommonJS      /* var dependencies = require(...) */     module.expor...
My situation  I'm checking out spine.js for a web application I'm thinking of writing. I've read all the documentation and gone through all the examples. Now I'm trying to run the spine.contacts example project on my own Windows 7 lap...
I'm not able to get TweeLite to work with browserify. I'm an extreme noob when it comes to CommonJS.  I've installed gasp v1.13.2 using Bower and include it like this:  var TweenLite = require("../../bower_components/gsap/src/minified...
I'm trying to pull an entire module into the current scope of another file after a require call.  For instance if my module looks like this:  exports.chai = require "chai" exports.mocha = require "mocha" exports.Q = require "q...
The title seems confusing but I'll give an example.  Let's say I create a module that uses ES6 that runs in the browser, so I use browserify with babelify to build everything.  Now I want to include that same module in a project that uses bro...
My CommonJS module uses a factory style object creation (.create()) and I try to have JSDoc style documentation but cannot figure out which JSDoc tags @class, @module etc. I should to use to do it nicely. Below you can see a simplified structure of t...
So, I am using RequireJS and React, trying to load a third-party component, which has been installed with:  npm install react-autocomplete   The structure is here: https://github.com/rackt/react-autocomplete/tree/master/lib  Now, I have a main.js fil...
I just took a shot at wrapping one of our modules that is meant to be included via a <script> tag in some boilerplate to allow optional AMD loading with requirejs.  It was quite painful and the best I could come up with is:  (function(){ var ex...
In version 2.0.2 of grunt-browserify, browserify-shim was removed from the module itself and converted to be used as a transform, rather than a straightforward option on a grunt-browserify task.  The old version of using the shim with grunt-browserif...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.