Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CommonJS style requires #62

Closed
chrislegault opened this issue Oct 4, 2018 · 4 comments
Closed

Support CommonJS style requires #62

chrislegault opened this issue Oct 4, 2018 · 4 comments

Comments

@chrislegault
Copy link

We have been writing our code in the CommonJS style as documented in the RequireJS area https://requirejs.org/docs/commonjs.html which doesn't seem like that style works in this plugin. I'm not a babel expert but I could try submitting a PR if it is something worthy to be included.

define(function (require) {
    var foo = require('foo');

    //Define this module as exporting a function
    return function () {
        foo.doSomething();
    };
});
@msrose
Copy link
Owner

msrose commented Oct 4, 2018

Hmm the simplified commonjs wrapper is supposed to be supported, it's not documented in the README but there are a bunch of test cases which describe how it gets transformed. Have you tried the plugin out in your environment? It's possible there are some bugs with the commonjs wrapper transformation since I don't think its usage is very common, so if you could post any specific errors you encounter that would be great.

@chrislegault
Copy link
Author

chrislegault commented Oct 4, 2018

Oh really? I was still seeing errors but it could be my set up. EDIT - Yeah I see you've got tests for the style I use. So probably my fault.

@chrislegault
Copy link
Author

Yup, sorry was me. Works!

@msrose
Copy link
Owner

msrose commented Oct 4, 2018

Awesome good to hear! Glad someone is actually making use of the simplified commonjs wrapper stuff :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants