Giter Site home page Giter Site logo

exposify's People

Contributors

bendrucker avatar cuth avatar jeswin avatar levacic avatar pdufour avatar thlorenz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

exposify's Issues

Can't get exposify to work with gulp

First of all, I'm not actually sure if this is an issue - it might be me who's misunderstanding how I'm supposed to use this - if so, sorry about that, and feel free to close the issue immediately, but I couldn't find a better way to contact you.

So, as the title says, I can't seem to get exposify to work at all. I'm trying to integrate it into a gulp build system. I've managed to reduce the problem to a very simple test case, and put it online: https://github.com/levacic/exposify-test

My use case is very basic, and according to the documentation, it's exactly what this library should be used for - I'm including jQuery via a <script> tag, but I want to be able to require it in my application code. I actually ran into these problems while trying to integrate browserify-shim, but upon failure, I figured I'd try just exposify, since it seems to be much simpler, and possibly easier to debug. I thought I could make this work first, and upgrade to browserify-shim afterwards, but I'm stuck.

Running "gulp" from the command line throws this error:

$ gulp
[gulp] Using gulpfile /home/levacic/www/exposify-test/gulpfile.js
[gulp] Starting 'default'...
[gulp] Finished 'default' after 3.6 ms

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: module "jquery" not found from "/home/levacic/www/exposify-test/source/app.js"
    at notFound (/home/levacic/www/exposify-test/node_modules/browserify/index.js:775:15)
    at /home/levacic/www/exposify-test/node_modules/browserify/index.js:726:23
    at /home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/index.js:183:24
    at /home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:44:14
    at process (/home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:110:43)
    at /home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:119:21
    at load (/home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:54:43)
    at /home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:22
    at /home/levacic/www/exposify-test/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47
    at Object.oncomplete (fs.js:107:15)

I have absolutely no idea what's the problem - I think I've done everything according to the documentation. When I tried the same thing with browserify-shim, I kept getting the same errors, even when just running browserify directly from the command line - so it shouldn't have anything to do with gulp.

Can you share some advice on what I'm doing wrong?

Thanks!

Allow config on call

I feel like it would be more conventional and convenient to allow setting the options when you call the function like other libraries do (eg. reactify, envify)

So you could just do

exposify({ jquery: '$', three: 'THREE' });

Is there any way to use exposed vars without `window.{varname}`?

For example, Im writing some jquery plugin in cjs style, then I bundling it:

(function(factory) {
  if (isNode) { ... factory(jQuery) } else if (isAMD) {... factory(jQuery) } else {... factory(jQuery) }
})(function(jQuery){
  return require('my_plugin');
});

Source of 'my_plugin' module:

module.exports = require("jquery");

And this code exposed after bundle like:

bundler.transform('exposify', {
  expose: {
    jquery: "jQuery"
  }
});
module.exports = (window.jQuery);

But I just want to use it like:

module.exports = (jQuery);

because of umd wrapper above.

Thanks! =)

Confused on Documentation

In the ReadMe for exposify it says:

Or use it via browserify-shim which allows you to provide exposify config inside your package.json among other features.

I'm really confused where in my package.json I would set exposify.config using browserify-shim. Can you provide an example or show a simple setup in the main page Readme?

Is it in the browserify transform option:

  "browserify": {
    "transform": [
      "browserify-shim",
      "exposify" <-- HERE
    ]
  },

Or perhaps in the browserify-shim config itself:

  "browserify-shim": {
    "jquery": "global:jQuery",
    "angular": {
      "exports": "angular",
      "depends": [
        "jquery:jQuery"
      ]
    },
    "hammer": "HammerJS",
    "kendo": {
      "depends": [
        "jquery:jQuery"
      ]
    }
  },

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.